Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 2.82 KB

README.md

File metadata and controls

59 lines (40 loc) · 2.82 KB

What?

3DSR (short for 3D Software Rasterizer) is a simple renderer that uses the rasterization technique, completely implemented in C++.

Libraries

  • tinyobjloader
  • SDL To set up a window and view the results of the rendering in real-time. None of the visuals drawn to the screen use SDL's functions for drawing to the screen.

Building and Running (Linux)

In the cloned repo:

  • mkdir build && cd build
  • cmake ..
  • make

Finally, use ./3DSR in the build folder to run it.

Lessons

  • Be careful of using std::numeric_limits<float>::min() since this will give you the lowest possible POSITIVE value. Use std::numeric_limits<float>::lowest() instead.
  • Be careful with loading data. For example, with tinyobjloader: make sure you're indexing into attrib.normals with the normal_index to get the normals.

References

For learning SDL2, this website has been very handy:

For a deeper overview into the basic rasterization algorithm:

About barycentric coordinates:

About homogeneous coordinates:

About the coordinate transform pipeline: