Simple software rasterizer in a single C++11 header file
github.com
github.com
Maybe start with chapter 38: http://downloads.gamedev.net/pdf/gpbb/gpbb38.pdf
http://stackoverflow.com/questions/495021/why-can-templates-...
Some popular shortcuts include:
- Cut at n hops (with n=4 or n=8 popular choices), defaulting to "ambient" light after that
- Give each material an "ambient" color, so that you don't actually need to trace every pixel back into every light source (just into e.g. spotlights)
- Solve a radiosity equation for the surface colors, and trace rays for textures/reflections.
Complete ray tracing is, indeed, insane - in fact, to get high quality pictures and avoid aliasing, most ray tracers send multiple rays through every picture and average the result.
Mine did Bresenham's algorithm for pixel fill rather than the winding approach used here.