Free online book series that teaches building a ray tracer from scratch in C++, with the full source code for each stage.
ssloy/tinyrenderer
A step-by-step course that teaches 3D rendering by building a software renderer in about 500 lines of bare C++, with no third-party libraries.
- Stars
- 24,450
- Forks
- 2,311
- Open issues
- 4
- Last commit
- 3 months ago
What is it?
Tinyrenderer is a tutorial series that teaches how 3D graphics APIs such as OpenGL, Vulkan, Metal and DirectX work internally. Instead of calling a GPU API, it builds a simplified renderer from scratch in software, covering line drawing, triangle rasterization, barycentric coordinates, z-buffering, camera handling, shading, texture and normal mapping, shadow mapping and ambient occlusion.
The code is intentionally small, around 500 lines of C++ with no external graphics dependencies. Its only helper is a single class for reading and writing TGA image files. The project is a learning resource: the course notes, which are the main content, walk through each stage in order, and the source is meant to be studied rather than reused as a library.
The program takes a triangulated 3D model with textures and outputs a rendered image, with no graphical interface. It builds with CMake.
Key features
- 01Builds a software renderer from scratch in about 500 lines of C++.
- 02Covers rasterization, z-buffering, camera setup, and shading step by step.
- 03Includes texture, normal mapping, shadow mapping and ambient occlusion topics.
- 04Uses no third-party graphics libraries, only a small TGA image reader and writer.
- 05Organized as a numbered series of course articles.
Use cases
- Learning how OpenGL or Vulkan pipelines work under the hood.
- Teaching a graphics course or workshop on rasterization basics.
- Understanding barycentric coordinates, z-buffers, and normal mapping before using GPU APIs.
Quick start
- 1
Clone the repository
git clone https://github.com/ssloy/tinyrenderer.git - 2
Enter the project directory
cd tinyrenderer - 3
Configure and build with CMake
cmake -Bbuild && cmake --build build -j - 4
Run the renderer on the sample models; output is saved to framebuffer.tga
build/tinyrenderer obj/diablo3_pose/diablo3_pose.obj obj/floor.obj
Things to know
- The code is a teaching exercise and the README says not to use it directly.
- It is a software renderer and does not show how to write GPU applications.
- The license is not clearly specified (NOASSERTION).
Topics
FAQ
- What is tinyrenderer?
- A step-by-step course that teaches 3D rendering by building a software renderer in about 500 lines of bare C++, with no third-party libraries. Tinyrenderer is a tutorial series that teaches how 3D graphics APIs such as OpenGL, Vulkan, Metal and DirectX work internally. Instead of calling a GPU API, it builds a simplified renderer from scratch in software, covering line drawing, triangle rasterization, barycentric coordinates, z-buffering, camera handling, shading, texture and normal mapping, shadow mapping and ambient occlusion.
- Is tinyrenderer free to use? What license does it have?
- tinyrenderer is open source under the Other license. Check the license terms before using it in commercial products.
- Is tinyrenderer still maintained?
- Updated within 6 months. The last commit to tinyrenderer was on Jul 29, 2026.
- What can I use tinyrenderer for?
- Learning how OpenGL or Vulkan pipelines work under the hood. Teaching a graphics course or workshop on rasterization basics. Understanding barycentric coordinates, z-buffers, and normal mapping before using GPU APIs.
- How do I install tinyrenderer?
- Clone the repository: git clone https://github.com/ssloy/tinyrenderer.git Enter the project directory: cd tinyrenderer Configure and build with CMake: cmake -Bbuild && cmake --build build -j Run the renderer on the sample models; output is saved to framebuffer.tga: build/tinyrenderer obj/diablo3_pose/diablo3_pose.obj obj/floor.obj
- Where can I get tinyrenderer?
- The source code and installation instructions are on GitHub: https://github.com/ssloy/tinyrenderer
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Blender is a free, open source 3D creation suite covering modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
A real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows and WebGL2, designed to be small and efficient on Android.
A free, open-source book and website that walks through modern C++ features from C++11 through C++26, organized by topic.
Rebuilds an object from one reference image as procedural, animation-ready Three.js TypeScript code, not a mesh file.
A Chinese-language knowledge base for game developers and tech leads, covering fundamentals, game engineering, production pipelines, team management and live operations.