Framework for rapid OpenGL demos prototyping.
This framework consists of two major parts:
- Core library - which is used as a static library for all examples. Source files are located in
src/core
. - Demos. Source files are located in
src/demos
.
After cloning the repository, run one of the .bat scripts to generate Visual Studio 2019/2022 solution:
- setup_vs2019.bat - to generate VS 2019 solution.
- setup_vs2022.bat - to generate VS 2022 solution.
Or run the following command in the root directory to generate project files with the default build system for your system:
cmake -B build
Either of these approaches will create project files in the build directory.
The following instructions are also located in src/demos/00_template_project/template_project.h
.
To begin creating a new demo using RapidGL framework follow these steps:
- Create new directory in
src/demos/<your_dir_name>
. - Add the following line to
src/demos/CMakeLists.txt
:add_subdirectory(<your_dir_name>)
. - Copy contents of
src/demos/00_template_project
tosrc/demos/<your_dir_name>
. - Change target name of your demo in
src/demos/<your_dir_name>/CMakeLists.txt
fromset(DEMO_NAME "00_template_project")
toset(DEMO_NAME "your_demo_name")
. - (Re-)Run CMake
Notes: After changing class name from e.g. TemplateProject to something else, update main.cpp
in <your_dir_name>
accordingly.
All of the demos are available in src/demos
.
This demo shows how to create camera, load models, generate primitives using built-in functions and add textures for specific objects.
This demo presents implementation of Blinn-Phong shading model for directional, point and spot lights.
This demo presents implementation of multitextured terrain. It uses a blend map (for varying X-Z texturing) and slope based texturing (for texturing the slopes).
This demo presents implementation of various toon shading methods (Simple, Advanced, Simple with Rim, Twin Shade) with different outline rendering methods (Stencil, Post-Process).
Implementation of a simple fog rendering. Three modes are available: linear, exp, exp2.
This demo shows implementation of an alpha cutout using fragments discarding.
Implementation of dynamic and static environment mapping (light reflection and refraction).
Demo presents projecting a texture onto a surface.
Negative, edge detection (Sobel operator) and Gaussian blur filters demo.
Demo presents generation of quad sprites from points data using Geometry Shader.
This demo implements Point-Normal tessellation algorithm (see main.cpp for references) with depth based level of detail (NOTE: works for each mesh with vertex normals).
Available presets: fountain, fire and smoke.
This demo presents simple model animation system using Assimp. There are two skinning methods available: Linear Blend Skinning and Dual Quaternion Blend Skinning.
Order Independent Transparency using linked lists (per pixel) with MSAA.
Including directional and punctual lights (spot and point) with square falloff attenuation. The demo supports textured and non-textured objects.
Bloom implementation based on Call of Duty: Advanced Warfare Jimenez14. Implemented using Compute Shaders with shared memory utilization for improved performance. Full bloom pass (1920x1080) takes ~0.75ms on NVidia GTX 1660 Ti with Max-Q Design (according to NVIDIA Nsight Graphics).
Clustered Forward Shading implementation based on Clustered Deferred and Forward Shading (2012) (Ola Olsson, Markus Billeter, Ulf Assarsson) and Jeremiah van Oosten's DX12 demo.
For light culling, I used view aligned AABB grid. During the lighting stage, only the visible clusters are taken into account (it greatly improves the performance as we limit the searching domain).
The demo is able to render ~100k lights at interactive frame rates (> 30FPS) on NVidia GTX 1660 Ti with Max-Q Design at 1920x1080 resolution.
To further improve the performance, you may look into adding lights BVH structure as described in O. Olsson's paper. Jeremiah van Oosten's DX12 demo includes the fully optimized version of clustered shading algorithm. I highly recommend looking into it.
19/07/2023 update: The demo now also supports the LTC Area Lights based on Eric Heitz's paper Real-Time Polygonal-Light Shading with Linearly Transformed Cosines (2016). The area lights are also being culled by the clustered shading algorithm.