HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
ssloy
tinyrenderer
C++2016–2025
ssloy / tinyrenderer

tinyrenderer

A brief computer graphics / rendering course

43Distinct people
55Mentions
2Explicit recommenders
24.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A brief computer graphics / rendering course

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

As pretty as this is I recommend reading all of his tutorial. Lots of it is old stuff that most of you will have seen takes on before, but he's got some great angles and…

lbj used a recommendation phrase. 2 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 6:01:08 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year55 dated mentions

Observed mentions: 2016-03-10 05:27:01 UTC to 2025-06-25 10:32:07 UTC.

0510152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 13 mentions; 4 submissions, 9 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 8 mentions; 1 submissions, 7 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 7 mentions; 1 submissions, 6 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC1349
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC817
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC202
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC808
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC404
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC303
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC716
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC404
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC303
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC312

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Software rendering in 500 lines of bare C++ The code itself is of little interest. Check the course notes: Introduction Bresenham’s line drawing algorithm Triangle rasterization Primer on barycentric coordinates Hidden faces removal A crude (but simple) approach to camera handling Better camera handling Shading More data! Tangent space normal mapping Shadow mapping Indirect lighting Bonus: toon shading Afterword In this series of articles, I aim to demonstrate how OpenGL, Vulkan, Metal, and DirectX work by writing a simplified clone from scratch. Surprisingly, many people struggle with the initial hurdle of learning a 3D graphics API. To help with this, I have prepared a short series of lectures, after which my students are able to produce quite capable renderers. The task is as follows: using no third-party libraries (especially graphics-related ones), we will generate an image like this: Warning: This is a training material that loosely follows the structure of modern 3D graphics libraries. It is a software renderer. I do not intend to show how to write GPU applications — I want to show how they work. I firmly believe that understanding this is essential for writing efficient applications using 3D libraries. The starting point The final code consists of about 500 lines. My students typically require 10 to 20 hours of programming to start producing such renderers. The input is a 3D model composed of a triangulated mesh and textures. The output is a rendering. There is no graphical interface, the program simply generates an image. To minimize external dependencies, I provide my students with a single class for handling TGA files — one of the simplest formats supporting RGB, RGBA, and grayscale images. This serves as our foundation for image manipulation. At the beginning, the only available functionality (besides loading and saving images) is the ability to set the color of a single pixel. There are no built-in functions for drawing line segments or triangles — we will implement all of this manually. While I provide my own source code, written alongside my students, I do not recommend using it directly, as doing the work yourself is essential to understanding the concepts. The complete code is available on github, and you can find the initial source code I provide to my students here. Behold, here is the starting point: #include "tgaimage.h" constexpr TGAColor white = {255, 255, 255, 255}; // attention, BGRA order constexpr TGAColor green = { 0, 255, 0, 255}; constexpr TGAColor red = { 0, 0, 255, 255}; constexpr TGAColor blue = {255, 128, 64, 255}; constexpr TGAColor yellow = { 0, 200, 255, 255}; int main(int argc, char** argv) { constexpr int width = 64; constexpr int height = 64; TGAImage framebuffer(width, height, TGAImage::RGB); int ax = 7, ay = 3; int bx = 12, by = 37; int cx = 62, cy = 53; framebuffer.set(ax, ay, white); framebuffer.set(bx, by, white); framebuffer.set(cx, cy, white); framebuffer.write_tga_file("framebuffer.tga"); return 0; } It produces the 64x64 image framebuffer.tga, here I scaled it for better readability: Teaser: few examples made with the renderer Compilation git clone https://github.com/ssloy/tinyrenderer.git && cd tinyrenderer && cmake -Bbuild && cmake --build build -j && build/tinyrenderer obj/diablo3_pose/diablo3_pose.obj obj/floor.obj The rendered image is saved to framebuffer.tga.
Read the full README on GitHub

What Hacker News says

13 sources
These are the other graphics related tutorials I have found. Ray Tracing in a Weekend Series. Most the way through the first book and I plan on continuing it. [1][2][3] Tiny Renderer - How OpenGL Works. A software renderer in 500 lines of code. Wiki has a full tutorial. [4] The Book of Shaders. A step by step introduction into fragment shaders. [5] [1] https://www.amazon.com/_/dp/B01B5AODD8 [2] https://www.amazon.com/_/dp/B01CO7PQ8C [3] https://www.amazon.com/_/dp/B01DN58P8C [4] https://github.com/ssloy/tinyrenderer/wiki [5] https://thebookofshaders.com/
In Scratchapixel: Computer Graphics Programming from Scratch
The title is a bit misleading, this is boilerplate code for a graphics programming course and it hasn't got much to do with OpenGL. The articles describing the operation are much more interesting than the code itself. It's just an inefficient triangle rasterizer. All it does is loop over the pixels in a rectangle covering a triangle, and for each pixel inside it calls a "shader" function. All the beef is in these 40 lines [0]. I don't know how they've done the texturing in all those pretty pictures (it's in the "shaders", not included here), but they don't calculate the partial derivatives required for correct, mipmapped texturing. Simple non-mipmapped perspective correct texture mapping can be computed in the shaders, with the usual caveats. OpenGL is much more than a rasterizer, there's texturing, depth-stencil operations, blending, com
Read the rest
pute shaders and efficient memory management. [0] https://github.com/ssloy/tinyrenderer/blob/master/our_gl.cpp... edit: Someone in reddit pointed out that this is a translation of a Russian language course. The original Russian version looks to be a bit longer than the English translation (but I don't read Russian, so I can't tell if it is better): https://habrahabr.ru/post/249467/
In How OpenGL works: software renderer in 500 lines of code

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.