All Projects → ssloy → Tinyrenderer

ssloy / Tinyrenderer

Licence: other
A brief computer graphics / rendering course

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to Tinyrenderer

Tinyraycaster
486 lines of C++: old-school FPS in a weekend
Stars: ✭ 1,383 (-88.26%)
Mutual labels:  fun, engine, opengl, graphics, 3d, rendering, computer-graphics, 3d-graphics, rendering-engine, tutorial, learning, images, picture
Tinyraytracer
A brief computer graphics / rendering course
Stars: ✭ 3,971 (-66.28%)
Mutual labels:  fun, graphics, 3d, shaders, rendering, computer-graphics, 3d-graphics, rendering-engine, tutorial, learning, images
Renderhelp
⚡️ 可编程渲染管线实现,帮助初学者学习渲染
Stars: ✭ 494 (-95.81%)
Mutual labels:  engine, opengl, graphics, 3d, shaders, rendering, 3d-graphics, rendering-engine, tutorial, learning, picture
Tinykaboom
A brief computer graphics / rendering course
Stars: ✭ 2,077 (-82.36%)
Mutual labels:  fun, graphics, 3d, shaders, rendering, computer-graphics, 3d-graphics, rendering-engine, tutorial, learning
Hybridrenderingengine
Clustered Forward/Deferred renderer with Physically Based Shading, Image Based Lighting and a whole lot of OpenGL.
Stars: ✭ 563 (-95.22%)
Mutual labels:  opengl, graphics, shaders, 3d-graphics, rendering-engine, learning
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (-0.66%)
Mutual labels:  opengl, graphics, 3d, shaders, 3d-graphics
Yave
Yet Another Vulkan Engine
Stars: ✭ 211 (-98.21%)
Mutual labels:  engine, 3d, shaders, rendering, 3d-graphics
Vxr
General purpose engine written in C++ with emphasis on materials rendering (PBR, clear coat, anisotropy, iridescence)
Stars: ✭ 181 (-98.46%)
Mutual labels:  engine, opengl, graphics, 3d, rendering
Glsltuto
GLSL shaders tutorial
Stars: ✭ 168 (-98.57%)
Mutual labels:  opengl, shaders, rendering, tutorial, learning
Softwarerenderer
Software rendering engine with PBR. Built from scratch on C++.
Stars: ✭ 323 (-97.26%)
Mutual labels:  graphics, shaders, 3d-graphics, rendering-engine, learning
Renderer
A shader-based software renderer written from scratch in C89
Stars: ✭ 1,366 (-88.4%)
Mutual labels:  graphics, 3d, shaders, rendering, 3d-graphics
Shaderworkshop
Interactive GLSL fragment shaders editor made with Qt
Stars: ✭ 43 (-99.63%)
Mutual labels:  opengl, graphics, shaders, rendering
Overload
3D Game engine with editor
Stars: ✭ 335 (-97.16%)
Mutual labels:  opengl, graphics, 3d-graphics, rendering-engine
Open3d
Open3D: A Modern Library for 3D Data Processing
Stars: ✭ 5,860 (-50.24%)
Mutual labels:  opengl, 3d, rendering, computer-graphics
Graphics Algorithm
3D图形学算法Code。包括软渲染、光线追踪、PBR等等~
Stars: ✭ 67 (-99.43%)
Mutual labels:  opengl, graphics, computer-graphics, rendering-engine
Leaf3d
A lightweight 3D rendering engine based on modern OpenGL
Stars: ✭ 16 (-99.86%)
Mutual labels:  opengl, 3d, shaders, rendering-engine
Herebedragons
A basic 3D scene implemented with various engines, frameworks or APIs.
Stars: ✭ 1,616 (-86.28%)
Mutual labels:  opengl, rendering, computer-graphics, software-rendering
Physics3d
A 3D physics engine
Stars: ✭ 101 (-99.14%)
Mutual labels:  engine, opengl, graphics, rendering
Bgfx
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Stars: ✭ 10,252 (-12.94%)
Mutual labels:  engine, opengl, graphics, rendering
Mini3d
3D Software Renderer in 700 Lines !!
Stars: ✭ 1,320 (-88.79%)
Mutual labels:  opengl, graphics, 3d, picture

Tiny Renderer or how OpenGL works: software rendering in 500 lines of code

Check the wiki for the detailed lessons.

compilation

git clone https://github.com/ssloy/tinyrenderer.git &&
cd tinyrenderer &&
mkdir build &&
cd build &&
cmake .. &&
make &&
./tinyrenderer ../obj/diablo3_pose/diablo3_pose.obj ../obj/floor.obj

The rendered image is saved to framebuffer.tga.

You can open the project in Gitpod, a free online dev evironment for GitHub: Open in Gitpod

On open, the editor will compile & run the program as well as open the resulting image in the editor's preview. Just change the code in the editor and rerun the script (use the terminal's history) to see updated images.

The main idea

My source code is irrelevant. Read the wiki and implement your own renderer. Only when you suffer through all the tiny details you will learn what is going on.

In this series of articles, I want to show the way OpenGL works by writing its clone (a much simplified one). Surprisingly enough, I often meet people who cannot overcome the initial hurdle of learning OpenGL / DirectX. Thus, I have prepared a short series of lectures, after which my students show quite good renderers.

So, the task is formulated as follows: using no third-party libraries (especially graphic ones), get something like this picture:

Warning: this is a training material that will loosely repeat the structure of the OpenGL library. It will be a software renderer. I do not want to show how to write applications for OpenGL. I want to show how OpenGL works. I am deeply convinced that it is impossible to write efficient applications using 3D libraries without understanding this.

I will try to make the final code about 500 lines. My students need 10 to 20 programming hours to begin making such renderers. At the input, we get a test file with a polygonal wire + pictures with textures. At the output, we’ll get a rendered model. No graphical interface, the program simply generates an image.

Since the goal is to minimize external dependencies, I give my students just one class that allows working with TGA files. It’s one of the simplest formats that supports images in RGB/RGBA/black and white formats. So, as a starting point, we’ll obtain a simple way to work with pictures. You should note that the only functionality available at the very beginning (in addition to loading and saving images) is the capability to set the color of one pixel.

There are no functions for drawing line segments and triangles. We’ll have to do all of this by hand. I provide my source code that I write in parallel with students. But I would not recommend using it, as this doesn’t make sense. The entire code is available on github, and here you will find the source code I give to my students.

#include "tgaimage.h"
const TGAColor white = TGAColor(255, 255, 255, 255);
const TGAColor red   = TGAColor(255, 0,   0,   255);
int main(int argc, char** argv) {
        TGAImage image(100, 100, TGAImage::RGB);
        image.set(52, 41, red);
        image.flip_vertically(); // i want to have the origin at the left bottom corner of the image
        image.write_tga_file("output.tga");`
        return 0;
}

output.tga should look something like this:

Teaser: few examples made with the renderer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].