Repolode
ssloy

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. 1

    Clone the repository

    git clone https://github.com/ssloy/tinyrenderer.git
  2. 2

    Enter the project directory

    cd tinyrenderer
  3. 3

    Configure and build with CMake

    cmake -Bbuild && cmake --build build -j
  4. 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