# ssloy/tinyrenderer

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/ssloy-tinyrenderer).**

23,252 stars · 2,215 forks · C++ · other

## Links

- GitHub: https://github.com/ssloy/tinyrenderer
- Homepage: https://haqr.eu/tinyrenderer/
- awesome-repositories: https://awesome-repositories.com/repository/ssloy-tinyrenderer.md

## Topics

`3d` `3d-graphics` `c-plus-plus` `computer-graphics` `cpp` `engine` `fun` `graphics` `images` `learning` `opengl` `picture` `pixels` `rasterizer` `rendering` `rendering-engine` `rendering-pipeline` `shaders` `software-rendering` `tutorial`

## Description

Tinyrenderer is a C++ library designed as an educational tool for building a 3D graphics pipeline from scratch. It provides a software-defined rendering environment that executes all geometric transformations and rasterization tasks on the central processor, intentionally avoiding reliance on external hardware acceleration or graphics libraries.

The project serves as a pedagogical resource for understanding the fundamental mathematical principles of computer graphics. It enables users to implement custom shader pipelines and core rendering techniques, such as barycentric coordinate calculation, depth buffering, and coordinate projection, to transform 3D models into 2D pixel buffers.

Beyond basic rasterization, the library covers a broad range of advanced rendering capabilities. These include surface illumination simulation, texture mapping, and visibility resolution through techniques like back-face culling and z-buffering. It also supports complex visual effects such as normal mapping, ambient occlusion, and various shadow rendering methods, allowing for the creation of detailed 3D environments within a custom-built software framework.

## Tags

### Graphics & Multimedia

- [Depth Buffers](https://awesome-repositories.com/f/graphics-multimedia/depth-buffers.md) — The renderer tracks the depth of each pixel during rendering and discards fragments that are obscured by previously drawn surfaces to ensure accurate hidden surface removal. ([source](https://haqr.eu/tinyrenderer/z-buffer/))
- [Software Renderers](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/engines/graphics-pipeline-architectures/software-renderers.md) — Executes the entire graphics sequence on the central processor without relying on external hardware acceleration or graphics libraries.
- [Software Rasterizers](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/graphics-apis-bindings/graphics-rendering-apis/dynamic-pixel-renderers/software-rasterizers.md) — Implements a complete software-based 3D graphics pipeline that performs all geometric transformations and rasterization on the CPU. ([source](https://haqr.eu/tinyrenderer/rasterization/))
- [3D Graphics Pipelines](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/systems/3d-graphics-pipelines.md) — Implements a complete software-based 3D graphics pipeline for rendering geometry.
- [Graphics Education Resources](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/graphics-education-resources.md) — Provides a pedagogical resource for understanding the fundamental mathematical principles and algorithms required to render complex three-dimensional scenes.
- [Rasterization Engines](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/systems/3d-graphics-pipelines/rasterization-engines.md) — Converts 3D meshes into 2D images through software-based rasterization. ([source](https://cdn.jsdelivr.net/gh/ssloy/tinyrenderer@master/README.md))
- [Matrix Transformation Engines](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/coordinate-viewport-transformations/matrix-transformation-engines.md) — Uses four-by-four homogeneous matrices to perform linear and affine transformations for positioning and projecting 3D geometry.
- [Triangle Rasterization](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/systems/3d-graphics-pipelines/rasterization-engines/triangle-rasterization.md) — Renders filled triangles by calculating pixel coverage via barycentric coordinates. ([source](https://haqr.eu/tinyrenderer/rasterization/))
- [Coordinate and Viewport Transformations](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/coordinate-viewport-transformations.md) — Maps 3D world space coordinates onto a 2D screen plane by applying scaling and translation transformations. ([source](https://haqr.eu/tinyrenderer/bresenham/))
- [Camera Projection Systems](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/coordinate-viewport-transformations/camera-projection-systems.md) — Deforms 3D space using a focal-length matrix to simulate depth and realistic perspective. ([source](https://haqr.eu/tinyrenderer/camera/))
- [Shaders](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/shaders.md) — Enables the creation of specialized shading models by manually calculating light interactions and surface properties.
- [Shadow Mapping](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/tile-map-renderers/shadow-mapping.md) — Calculates shadows by comparing fragment depth against a light-source depth map. ([source](https://haqr.eu/tinyrenderer/shadow/))
- [Lighting Systems](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/lighting-systems.md) — Simulates indirect lighting and depth by calculating ambient occlusion. ([source](https://haqr.eu/tinyrenderer/ssao/))
- [Screen Space Ambient Occlusion](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/lighting-systems/logit-space-lighting-adjusters/screen-space-ambient-occlusion.md) — Approximates contact shadows by sampling the depth buffer in screen space. ([source](https://haqr.eu/tinyrenderer/ssao/))
- [Vertex Attribute Interpolators](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/graphics-pipeline-configurations/vertex-buffer-generators/vertex-attribute-interpolators.md) — Computes values for pixels inside a triangle by performing a weighted average of vertex data based on their barycentric coordinates. ([source](https://haqr.eu/tinyrenderer/barycentric/))
- [3D Surface Visualizations](https://awesome-repositories.com/f/graphics-multimedia/media-production-suites/animation-tools/mathematical-visualization-engines/3d-surface-visualizations.md) — Simulates realistic material properties by calculating ambient, diffuse, and specular lighting. ([source](https://haqr.eu/tinyrenderer/shading/))
- [Viewport Transformations](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/coordinate-viewport-transformations/viewport-transformations.md) — Maps transformed 3D coordinates to the final 2D screen space for display. ([source](https://haqr.eu/tinyrenderer/camera/))
- [Visibility Sorting](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/systems/3d-graphics-pipelines/rasterization-engines/triangle-rasterization/visibility-sorting.md) — The renderer orders geometric primitives from back to front so that closer surfaces overwrite distant ones during the rasterization process to simulate correct visibility. ([source](https://haqr.eu/tinyrenderer/z-buffer/))
- [Geometry Parsers](https://awesome-repositories.com/f/graphics-multimedia/media-production-suites/3d-modeling-software/geometry-parsers.md) — Reads vertex and face data from standard text-based geometry files to reconstruct 3D objects for rendering. ([source](https://haqr.eu/tinyrenderer/bresenham/))

### Education & Learning Resources

- [Computer Graphics](https://awesome-repositories.com/f/education-learning-resources/educational-resources/systems-applied-computing/scientific-and-specialized-computing/computer-graphics.md) — Serves as a pedagogical resource for learning fundamental computer graphics and rendering algorithms.
- [Algorithm Implementations](https://awesome-repositories.com/f/education-learning-resources/algorithm-implementations.md) — Implements core rendering techniques like barycentric interpolation, depth testing, and coordinate transformations for academic purposes.

### Development Tools & Productivity

- [C++ Rendering Libraries](https://awesome-repositories.com/f/development-tools-productivity/header-only-libraries/c-rendering-libraries.md) — Provides a header-only C++ implementation of a 3D graphics pipeline.

### Software Engineering & Architecture

- [Back-Face Culling Utilities](https://awesome-repositories.com/f/software-engineering-architecture/performance-reliability/performance-optimization/frustum-culling-utilities/back-face-culling-utilities.md) — Optimizes rendering performance by identifying and ignoring triangles oriented away from the camera. ([source](https://haqr.eu/tinyrenderer/z-buffer/))

### User Interface & Experience

- [Barycentric Rasterizers](https://awesome-repositories.com/f/user-interface-experience/drawing-tools/raster-primitives/barycentric-rasterizers.md) — Implements barycentric coordinate calculation to determine pixel coverage within triangles during the rasterization process.
- [Barycentric Calculators](https://awesome-repositories.com/f/user-interface-experience/coordinate-systems/coordinate-converters/barycentric-calculators.md) — Determines the relative position of a point within a triangle by computing weights that represent the area ratios of sub-triangles. ([source](https://haqr.eu/tinyrenderer/barycentric/))
- [Shadow Mapping](https://awesome-repositories.com/f/user-interface-experience/shadow-utilities/shadow-mapping.md) — Determines surface occlusion by comparing fragment depth against a pre-rendered scene representation from the light source perspective.
- [Homogeneous Transformation Utilities](https://awesome-repositories.com/f/user-interface-experience/transformation-matrices/homogeneous-transformation-utilities.md) — Uses four-by-four matrices to perform translations and perspective projections through matrix multiplication. ([source](https://haqr.eu/tinyrenderer/camera/))
- [Camera Systems](https://awesome-repositories.com/f/user-interface-experience/camera-systems.md) — Positions and orients a virtual camera in 3D space using eye, center, and up-vector parameters. ([source](https://haqr.eu/tinyrenderer/camera/))
- [Attribute Interpolators](https://awesome-repositories.com/f/user-interface-experience/high-performance-interpolation/attribute-interpolators.md) — Computes smooth values for surface properties across triangles by performing weighted averages of vertex data during rasterization.
- [Texture Mapping](https://awesome-repositories.com/f/user-interface-experience/texture-mapping.md) — Assigns 2D coordinates to 3D vertices to enable the projection of images onto geometry during the rasterization process. ([source](https://haqr.eu/tinyrenderer/textures/))
- [Texture Samplers](https://awesome-repositories.com/f/user-interface-experience/texture-mapping/texture-samplers.md) — Retrieves color or vector information from image files based on interpolated coordinates to apply surface details. ([source](https://haqr.eu/tinyrenderer/textures/))
- [Tangent Space Normal Mapping](https://awesome-repositories.com/f/user-interface-experience/texture-mapping/tangent-space-normal-mapping.md) — Applies surface details using tangent-space normal maps to enhance visual realism. ([source](https://haqr.eu/tinyrenderer/tangent/))
