Foundation is a work-in-progress cross-platform rendering framework/renderer.
Foundation includes three bespoke renderers - The Progressive Path Tracer PPT based on Physically Based Rendering:From Theory To Implementation, a Continuous LOD Meshlet (Nanite-like) Rasterizer RASTER, and a Real-time Pathtracer RTPT
Please note that the Path Tracer is not a faithful recreation of PBRT - however heavily referenced against, with outputs extensively verified against results from Blender Cycles et al. PT outputs can be considered reference in this context.
Canonical glTF format scenes are supported, alongside ones with private extensions made for Foundation itself. https://github.com/mos9527/Foundation-Blender-IO is used for scene interchange between Blender and Foundation.
Sample scene and resources can be found at https://github.com/mos9527/Foundation-Resources
Material Models
Principled Material
Layered PBR material interface based on the OpenPBR model (as seen in Blender's Principled BSDF), offering full support with the exception of 3.8 Thin-film iridescence

Principled Hair Material
Principled Hair BSDF's Chiang single-scattering model implementation. Many bounces may be required to derive accurate hair scattering phenomena.
Color Pipeline
- OCIO-based SDR & HDR color pipeline
- Linear BT.709 scene space (D65), converted to D60 via Bradford CAT and encoded as AP1
- ACEScct log-space encoding for grading and display transforms
- LUT-based output transforms for SDR/HDR — ACES 1.3, ACES 2.0, AgX, Standard (sRGB and PQ)
- 1-to-1 match with Blender OCIO output
Path Tracer
- Full Foundation Material support
- Unidirectional megakernel integrator
- Energy conserving BSDFs with Cycles output parity
- Sobol & PCG samplers
- Path-traced Subsurface scattering
- Path-traced Chiang Hair/fur shading
- Curve rendering for hair/fur, etc
- Importance sampled environment maps
- Anamorphic physical lens
- Area, point, spot, and directional lights
- Context-dependent Light BVH sampling for analytical lights
Rasterizer
- GPU-driven mesh shader pipeline with hierarchical continuous LOD
- Two-phase meshlet occlusion culling
- Optional RT Shadows
Realtime Path Tracer
- Basic PBR material support
- SHARC integration
Scene
Examples
Smaller examples, using the framework as a library (therefore excluding the renderers) are provided for reference and testing purposes.
These be found in The Examples directory.
TODO SCREENSHOTS
Building
cmake is required for builds. A C++20 compliant compiler is also required.
All third-party dependencies are included as FetchContent declarations. See Thirdparty for a comprehensive list.
Slang is required for building shaders for all backends, and should be available in your PATH.
Vulkan SDK is required for building the VulkanApplication backend.
Windows
You can build, and debug the app with Visual Studio's CMake intergration. Or with any alternative CMake workflow of your choice.
The Vulkan SDK installer should take care of most, if not all the setup for you.
CI Builds are provided for this platform. You can get them from nightly
Linux
Refer to https://docs.vulkan.org/tutorial/latest/02_Development_environment.html#_linux_2 for setting up the Vulkan SDK on Linux.
- Arch Linux
# Enable [extra-testing] in /etc/pacman.conf for the latest validation layers et al
sudo pacman -S vulkan-validation-layers vulkan-tools vulkan-radeon vulkan-headers
macOS
Install the official Vulkan SDK PKG, and expect things to just build through CMake as usual.
Android
Open Android/ as a project in Android Studio and suffer - that should (hopefully) be enough.
Notes on example selection - for CI and Android only select examples are built. These are populated by:
python Scripts/GenerateExamples.py
Building from command line
Binary artifacts will be located in build/bin/.
mkdir build
cd build
cmake ..
cmake --build . -j8
Build Options
The following CMake options are available:
| Option | Description | Default |
| FOUNDATION_NO_EXCEPTIONS | Build without exceptions | ON |
| FOUNDATION_RHIVULKAN_VALIDATION_LAYER | Build with Vulkan Validation Layer enabled | ON |
| FOUNDATION_WITH_ASAN | Build with Address Sanitizer enabled | OFF |
| FOUNDATION_WITH_TSAN | Build with Thread Sanitizer enabled | OFF |
| FOUNDATION_WITH_PROFILING | Build with profiler (Tracy) enabled | ON |
| FOUNDATION_WITH_EXAMPLES | Build examples | ON |
| FOUNDATION_WITH_JOLT_EXAMPLES | Build examples that require Jolt Physics | OFF |
| FOUNDATION_OS_ALLOCATOR | Build with OS allocator, instead of using mimalloc | ON |
- NOTE: On MinGW GCC, you might need
-DFOUNDATION_OS_ALLOCATOR=ON to use the OS allocator should you encounter crashes into ntdll!RtlFreeHeap.
Toggle these options with -D<OPTION>=ON/OFF when running cmake .., e.g. cmake -FOUNDATION_WITH_ASAN=ON ..
CMake Unity Builds are supported, and can be enabled with -DCMAKE_UNITY_BUILD=ON when running cmake ...
Third party
Core
Math
RHIVulkan
Editor, Examples & Tests
Debugging
Vulkan
- VVL Timeline resource tracking has been an issue - though should be resolved by now. Always update the SDK to the latest version.
- RenderDoc is generally enough for most debugging tasks.
- Though some esoteric issues would eventually require HW specific tools for accurate timing and performance metrics.
TODOs
Framework
We use Vulkan exclusively, so portability wise:
- [x] Desktop (Windows & Linux) is probably the only platform we truly care about
- RT & Mesh Shader usage practically means anything DirectX 12 Ultimate Certified will Just Work(tm)
- [ ] TODO Fallback path for Raster to invoke MDI when running without Mesh Shader support?
- [-] Android
- Inline Ray Tracing is surprisingly solid & widely supported on mobile Androids nowadays
- As ridiculous as it sounds - GPUScene Examples can run on those devices. Turns out you can do HW accelerated Path Tracing on mobile...
- Mesh Shaders are mostly amiss. Newer (8Gen3) Adrenos offer support - not sure about other chips.
- [-] Metal (iDevices and Macs)
- MoltenVK, KosmickKrisp
- Neither supports RT nor Mesh Shaders.
- Other examples work on both. That, and Mesa
llvmpipe (headless)...
- [x] Lavapipe
Editor
- [x] Correct SDR&HDR Color Pipeline
- Linear BT709 Scene Space (D65), converted to D60 via Bradford CAT and encoded as AP1
- Transform then encodes as ACEScct
- Rest of the transform handled by LUTs in ACEScct log space, incl. to display EOTF. See
Scripts/OCIOBakeLUTs.py
- Blender OCIO Config used to generated LUTs for SDR/HDR ACES1.3/2.0/AgX/Standard (sRGB. v. PQ) transforms
- [ ] Coroutines in place of...whatever this is. Good to have, not necessary.
- [ ] Scene Graph, instead of AoS to represent instances. Done
- [x] Animation (Skinning, BlendShapes, Articulated rigid bodies, camera & lights. Contribution by Claude)
Progressive Path Tracer
Sorted by priority (high to low), also w/ future blog post series update on:
- [ ] Emissive triangles in NEE
- [ ] Tracing from surfaces (for baking lightmaps, probe generation, etc)
Done, awaiting Blog Update:
- [x] Adaptive Sampling (https://jo.dreggn.org/home/2009_stopping.pdf)
- [x] Hair Shading
- [x] Curve (hair, fur) rendering
- [x] Path Traced Skin BSSRDF
- Disney BSSRDF from PBRTv3
- Uniformly selects exitance point on scattered path via AnyHit + reservoir sampling
- [x] Transparent shadows from Area Lights
- Environment lights and emissive objects naturally cast caustics.
- Area lights are also added as procedural geometry into TLAS, allowing them to be hit by BSDF rays and evaluated with MIS w/ NEE.
- Needs a large energy/firefly clamp.
- Not done for analytical lights (Point/Directional) as they are delta distributions and cannot be hit by BSDF rays.
- Conversion to small disk lights is feasible, or another O(N) loop to evaluate all of those inline w/o going through scene BVH
- Not worth it nonetheless. This is merely brute-forcing.
- [x] Light BVH sampling for scene lights
- [x] Importance sampling Infinite Image Lights
Done:
- Revisiting Physically Based Shading at Imageworks - Kulla & Conty 2017
- [x] Complete Multiscatter Energy Compensation
- See also
Scripts/LUTPrecomputeGGX.ipynb
- [x] Dielectrics Reflection
- Approximate aniso materials with the same LUT
- [x] Dielectrics Transmission
- Implies another dimension on IOR
- Darkening still noticeable at medium roughness.
- [x] Texture sampling rate via ray differentials for primary rays
- Easy for camera rays, not so much for ones bouncing off BSDFs
- [x] Coat BSDF
- [x] Sheen BSDF/SGGX approx.
- [x] PCG (Independent), Sobol Samplers
Raster
Unfortunately not the favourite child. Maybe one day.
- [x] IBL
- [x] Screen Space Ambient Occlusion
- [x] GTAO
- Dollar store version. Doesn't even bother with denoising. Taken from Unity HDRP.
- [ ] Screen Space Reflections
- [ ] Screen Space Diffuse GI
- [ ] Light Probe Volumes
- [ ] Really Speed up meshlet continuous LOD selection.
- We're O(N). Nanite does it O (log N) via BVH
Realtime Path Tracer
- [ ] (Light sampler uses Progressive PT ones - TODOs omitted here)
- [ ] ReSTIR PT/DI