Skip to content

Latest commit

 

History

History
266 lines (222 loc) · 14.3 KB

File metadata and controls

266 lines (222 loc) · 14.3 KB

Foundation {#mainpage}

Foundation is a work-in-progress cross-platform rendering framework/renderer.

Foundation includes two bespoke renderers - The Path Tracer PT based on Physically Based Rendering:From Theory To Implementation, and a Continuous LOD Meshlet (Nanite-like) Rasterizer RASTER.

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

Blender Principled BSDF

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

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 @ref 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 @ref 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_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_RHIVULKAN_VALIDATION_LAYER Build with Vulkan Validation Layer enabled ON
FOUNDATION_WITH_EXAMPLES Build examples ON
FOUNDATION_WITH_TESTS Build tests ON

Toggle these options with -D<OPTION>=ON/OFF when running cmake .., e.g. cmake -DFOUNDATION_WITH_SANITIZERS=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

TODOs

Framework

We use Vulkan exclusively, so portability wise:

  • 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)...
  • Lavapipe

Editor

  • 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

  • Animation (Skinning, BlendShapes, Articulated rigid bodies, camera & lights. Contribution by Claude)

Path Tracer

Sorted by priority (high to low), also w/ future blog post series update on:

  • Emissive triangles in NEE, ReSTIR DI/PT
  • Tracing from surfaces (for baking lightmaps, probe generation, etc)

Done, awaiting Blog Update:

Done:

Raster

Unfortunately not the favourite child. Maybe one day.

  • IBL
  • Screen Space Ambient Occlusion
    • 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