Skip to content

A simple rendering library to experiment with CG techniques in OpenGL

License

Notifications You must be signed in to change notification settings

jankozik/sketchlib-opengl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SketchLib - physically-based renderer

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.

Requirements

Dependencies

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

How to build (Windows only)

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.

Screenshots

image

Features

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

TODO list?

  • 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

References

About

A simple rendering library to experiment with CG techniques in OpenGL

Topics

Resources

License

Stars

Watchers

Forks