Skip to content

andrew-lim/sw3dcpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Andrew Lim's C++ 3D Software Rasterizer

Personal 3D playground program for me to test and learn 3D rendering. Source code made public in case somebody finds it helpful. Though it is a still a very much work in progress.

You will need a C++ 11 compiler. Currently I'm developing with Embarcadero Dev-C++

All rendering is done first on a custom ImageData class which just holds a 2D array of bytes (aka std::uint8_t). Then the bytes are transferred/blitted to the native screen format. In this case, I'm testing with Win32 GDI where the bytes are displayed with SetDIBitsToDevice.

Download Latest Release Here.

Screenshots

Videos

YouTube Playlist

Features

  • 4 triangle rendering algorithms: standard scanline, barycentric, and 2 optimized barycentric variants
  • Displays a simple textured cube at the start
  • Loading .OBJ and .MTL files with BMP/PNG support. Sample models can be loaded from the Debug menu
  • Solid, Affine and Nearest Neighbour Perspective-Correct Texture Mapping
  • Clipping by near plane only, or clipping by all 6 planes
  • Z Buffer
  • Flat and Smooth/Gourand Lighting

Libraries Used

  • lodepng for PNG loading
  • tinyobjloader for .OBJ parsing
  • glm was previously used for matrix math but has been replaced by custom Matrix and Vector classes. However it is still distributed together with the source code.

MIT Licensed

About

Personal C/C++ 3D Software Rasterizer

Resources

License

Stars

Watchers

Forks

Packages

No packages published