This is a simple rendering library built with OpenGL 4.6 and C++17, the purpose of which is to experiment with a wide range of rendering techniques and see how these ideas are put into practice in a rasterization pipeline. Unlike offline path tracing which is based mostly on math and physics rules, RTR is full of little hacks and compromises due to the 60 FPS constraint. There are also lots of low-level details behind the graphics API, so we need a solid understanding of every step in the rendering pipeline.
This project is initially started as an exercise to learn the basics of graphics in modern OpenGL, which has since then incorporated some ideas from game engine architecture to raise up the scope and level of abstraction. It is designed with modularization in mind to let users prototype new scenes with relative ease, thus we can focus more on the rendering algorithms without worrying too much about details. This can also be a useful framework and codebase for future reference, and a good starting point for implementing something more feature-complete and advanced.
This is no longer maintained but only serves as a basic source of reference. I'm migrating to Vulkan for the next one and will focus more on the engineering side.
- Visual Studio 2019 or later + optional extensions: GLSL Language Integration and Visual Assist
- Desktop Windows 10/11 with OpenGL 4.6 support + Premake5 (included in the
\vendor
folder)
- GLFW (v3.3.2+) or FreeGLUT (v3.0.0 MSVC Package), GLAD, GLM (v0.9.2+), spdlog (logging library)
- Dear ImGui (GUI), ImGuizmo (Gizmo), IconFontCppHeaders, Optick (profiler), taskflow (parallel tasks system)
- EnTT (entity-component system), Date (time zone), stb (image loader), Assimp (compile from sources)
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg.exe install assimp # x86 build
./vcpkg.exe install assimp:x64-windows # x64 build
The premake5.lua
script will handle all the workspace/project/build settings for us, there's no need to configure build/release
or win32/x64
manually, just run premake.bat
and you are good to go. Alternatively, you can also build the solution on the command line like so:
git clone https://github.com/neo-mashiro/sketchlib-opengl.git
cd sketchlib-opengl/
vendor/premake/premake5.exe vs2019
The \vendor
folder already contains the pre-compiled binaries of all dependencies listed above, simply open the solution in Visual Studio and start building. Upon success, executables will be built into a sub-folder in \bin
for the selected platform, and all dependent DLLs will be automatically copied over there. You can also move the exe folder around without problems, as long as it's inside root, paths are automatically deducted.
To be able to run the scenes, make sure you have downloaded the assets separately, see this page for details.
Application | Rendering |
---|---|
manage objects with entity-component system | tiled forward rendering (screen space) |
runtime scene loading and scene switching | physically-based shading and image-based lighting |
skeleton animation for humanoid models | physically-based materials (simplified Disney BSDF) |
FPS camera with smooth zoom and arcball control | compute shader IBL baking |
blazingly fast native screen capturing (GDI+) | compute shader bloom effect |
independent resource and asset managers | compute shader cloth simulation |
smart material system and viewable framebuffers | configurable wireframe rendering |
smart OpenGL context switching | Blender-style infinite grid |
automatic resolve std140 layout |
off-screen MSAA |
support #include directives in GLSL |
omnidirectional PCSS shadows (Poisson disk) |
all shaders in one file (except compute shader) | runtime transformation control using Gizmos |
built-in clock and framerate counter | tone mapping and gamma correction |
- Fix cloth blending artifacts in scene04 using Order-Independent Transparency (OIT)
- Data-oriented scene graph, transformation trees, see "3D Graphics Rendering Cookbook 2021" Ch.7
- Scene graph serialization in readable YAML format
- Precomputed Radiance Transfer (PRT) and light transport, see GAMES202 homework 2
- Screen Space Reflection (SSR), see GAMES202 homework 3
- Frame Graph (reference Filament) and Temporal Anti-Aliasing (TAA)
- Raymarching, SDFs and tessellated terrain, see https://iquilezles.org/articles/
- Compute shader particle systems, realistic fire, smoke and water simulation
- Volumetric lights and subsurface scattering (can only hack in realtime, not physically based)
- Optimization: frustum culling, clustered tiled rendering (voxelized), batch rendering, indexed drawing
- Refactor design to include Taskflow and Optics, integrate Bullet physics and OpenAL audio
- GLSL 4.60 Specification
- Learn OpenGL Tutorial
- C++ & Hazel Game Engine Series by Cherno
- OpenGL 4 Shading Language Cookbook, Third Edition
- Physically Based Rendering in Filament
- SIGGRAPH Physically Based Shading Course 2012-2020
- pbrt book v3
- GAMES 202, Advanced Real-time Rendering
- CMU 15-462, Compute Graphics
- CMU 15-468, Physics-based Rendering