Skip to content

trevinwong/3DSR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

3D software rasterizer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published