RTGL1 is a library that aims to simplify the process of porting 3D applications to real-time path tracing, via hardware accelerated ray tracing, denoising algorithms (A-SVGF) and sampling algorithms (ReSTIR, ReSTIR GI) to improve the image quality by reusing spatio-temporal data.
Requirements:
Clone the repository
git clone https://github.com/sultim-t/RayTracedGL1.git
Configure with CMake
RG_WITH_SURFACE_WIN32
RG_WITH_SURFACE_METAL
RG_WITH_SURFACE_WAYLAND
RG_WITH_SURFACE_XCB
RG_WITH_SURFACE_XLIB
mkdir Build
cd Build
cmake ..
Build/x64-Debug
or Build/x64-Release
Build
cmake --build .
Build shaders
Source/Shaders/GenerateShaders.py
with Python3, it will generate SPIR-V files to Build
folderRgInstanceCreateInfo::pBlueNoiseFilePath
. A ready-to-use resource can be found here: Tools/BlueNoise_LDR_RGBA_128.ktx2
RTGL1 supports shader hot-reloading (a target application sets RgStartFrameInfo::requestShaderReload=true
in runtime).
But to ease the process of building the shaders, instead of running GenerateShaders.py
from a terminal manually, you can install Visual Studio Code and Script Runner extension to it. Open Sources/Shaders
folder, add such config to VS Code's .json
settings file (TODO: VS Code workspace).
"script-runner.definitions": { "commands": [ { "identifier": "shaderBuild", "description": "Build shaders", "command": "cls; python .\GenerateShaders.py -ps", "working_directory": "${workspaceFolder}", }, { "identifier": "shaderGenAndBuild", "description": "Build shaders with generating common files", "command": "cls; python .\GenerateShaders.py -ps -g", "working_directory": "${workspaceFolder}", } ], },
Then assign hotkeys to shaderBuild
and shaderGenAndBuild
commands in File->Preferences->Keyboard Shortcuts
.
Some games don't have PBR materials, but to add them, RTGL1 provides 'texture overriding' functionality: application requests to upload an original texture and specifies its name, then RTGL1 tries to find files with such name (appending some suffixes, e.g. _n
for normal maps, or none for albedo maps) and loads them instead of original ones. These files are in .ktx2
format with a specific compression and contain image data.
To generate such textures:
Python3
are requiredTools/CreateKTX2.py
, create folder named Raw
and Compressed
.INPUT_EXTENSIONS
) in Raw
folder.ktx2
file to Compressed
folder, preserving the hierarchyOn RTGL1 initialization, RgInstanceCreateInfo::pOverridenTexturesFolderPath
should contain a path to the Compressed
folder.