A Hydra-enabled GPU path tracer that supports MaterialX.

gatling

1965 Ford Mustang Fastback from Wire Wheels Club, rendered in Gatling.

About

This is my toy path tracer I work on in my free time.

It is exposed as a Hydra render delegate and comes with a standalone that accepts Universal Scene Description (USD) files [Elkoura et al. 2019]. Both UsdPreviewSurface and MaterialX [Smythe et al. 2019] material network nodes are supported.

Gatling features a BVH builder with binned SAH [Wald 2007], spatial splits [Stich et al. 2009], SAH-preserving widening to nodes of 8 childs, compression, and an efficient traversal kernel [Ylitie et al. 2017]. Complex BSDFs like the Autodesk Standard Surface and the Disney BRDF are supported and importance sampled.

Build

The following is required:

Do a recursive clone of the repository and set up a build folder:

git clone https://github.com/pablode/gatling --recursive
mkdir gatling/build && cd gatling/build

Pass following parameters in the CMake generation phase:

cmake .. -Wno-dev \
         -DUSD_ROOT=
   
     \
         -DMDL_ROOT=
    
      \
         -DCMAKE_INSTALL_PREFIX=
     
      /plugin/usd
         -DCMAKE_BUILD_TYPE=Release

     
    
   

Note: If you're using MSVC, be sure to select a 64-bit generator.

Build the relevant targets and install the Hydra delegate to the USD plugin folder:

cmake --build . -j8 --target hdGatling gatling --config Release
cmake --install . --component hdGatling

DXC

On Windows, Microsoft's DirectX Shader Compiler (DXC) can be used instead of Khronos's glslang. This allows for validation of the generated HLSL shader.

Download the DXC June 2021 binaries and set -DDXC_ROOT in the CMake generation phase to point to the unpacked folder. You can switch between both shader compilers using the -DGATLING_USE_DXC option.

Usage

Gatling can be used by every application which supports Hydra, either natively or through a plugin.

cekuhnen's Coffee Maker (CC-BY), slightly modified, rendered using Gatling inside Pixar's usdview tool.

A headless standalone is provided that accepts a USD file (.usd, .usda, .usdc, .usdz) as input. Make sure that there is a polygonal light source in the scene.

./bin/gatling 
   
     render.png \
    --image-width 1200 \
    --image-height 1200 \
    --spp 1024 \
    --max-bounces 8

   

Note: Disable the system's GPU watchdog or set an appropriate timeout value.

Outlook

Basic texturing is the next important feature. After that, support for MDL materials will be considered.

Further Reading

Smythe et al. 2019

Doug Smythe, Jonathan Stone, Davide Pesare, Henrik Edström. 2019. MaterialX: An Open Standard for Network-Based CG Object Looks. ASWF Open Source Day SIGGRAPH 2019. Retrieved October 25, 2021 from https://www.materialx.org/assets/MaterialX_Sig2019_BOF_slides.pdf.

Elkoura et al. 2019

George Elkoura, Sebastian Grassia, Sunya Boonyatera, Alex Mohr, Pol Jeremias-Vila, and Matt Kuruc. 2019. A deep dive into universal scene description and hydra. In ACM SIGGRAPH 2019 Courses (SIGGRAPH '19). Association for Computing Machinery, New York, NY, USA, Article 1, 1–48. DOI:10.1145/3305366.3328033

Ylitie et al. 2017

Henri Ylitie, Tero Karras, and Samuli Laine. 2017. Efficient incoherent ray traversal on GPUs through compressed wide BVHs. In Proceedings of High Performance Graphics (HPG ’17). Association for Computing Machinery, New York, NY, USA, Article 4, 1–13. DOI:10.1145/3105762.3105773

Stich et al. 2009

Stich, Martin & Friedrich, Heiko & Dietrich, Andreas. 2009. Spatial splits in bounding volume hierarchies. In Proceedings of the Conference on High Performance Graphics 2009 (HPG ’09). Association for Computing Machinery, New York, NY, USA, 7–13. DOI:10.1145/1572769.1572771

Wald 2007

Ingo Wald. 2007. On fast Construction of SAH-based Bounding Volume Hierarchies. In Proceedings of the 2007 IEEE Symposium on Interactive Ray Tracing (RT '07). IEEE Computer Society, USA, 33–40. DOI:10.1109/RT.2007.4342588

License


    Copyright (C) 2021 Pablo Delgado Krämer

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see 
   .

Owner
Pablo Delgado
CS student. Interested in Computer Graphics, GPUs, Vulkan and Ray Tracing!
Pablo Delgado
Comments
  • Can you share a simplest test scene? even a box

    Can you share a simplest test scene? even a box

    I got the following error while running

    Exception generating MDL code: Could not find a nodedef for shadernode 'SR_Invalid'

    My guess is that my scene is not built correctly.

    Any help would be greatly appreciated.

    Aaron

  • License for cgpu?

    License for cgpu?

    I like your minimalistic compute library (cgpu) and would like to use it in some other personal projects.

    Your current license is GPL. Is there any way you could change the license to more permissive (or dual license) for cgpu.h and cgpu.c?

  • About the assets in the usd-assets repository

    About the assets in the usd-assets repository

    The assets in the usd-assets repository don't seem to come with texture, can you simply demonstrate one for viewing?

    repository: https://github.com/pablode/usd-assets

    Be deeply grateful!

    Aaron

  • Compile errors on Linux

    Compile errors on Linux

    I am trying to compile on Linux (Manjaro) with gcc 11.

    I am getting two errors:

    1. src/hdGatling/src/Camera.cpp:39

    error: ‘atanf’ is not a member of ‘std’

    This can be easily fixed by using atanf and not std::atanf.

    1. Linking error:

    Linking CXX shared library ../../bin/hdGatling.so /usr/bin/ld: ../../bin/libshadergen.a(MdlHlslCodeGen.cpp.o): warning: relocation against _ZN2sg19MATERIAL_STATE_NAMEE' in read-only section.text' /usr/bin/ld: ../../bin/libgi.a(gi.c.o): relocation R_X86_64_PC32 against symbol `[email protected]@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC

    Any ideas?

  • fix missing headers

    fix missing headers

    gatling/src/gi/src/bvh_embree.cpp:146:28: error: ‘fminf’ was not declared in this scope

    gatling/src/imgio/src/mmap.c:342:8: error: unknown type name ‘uint32_t’

  • Compile error due to case sensitive on Linux

    Compile error due to case sensitive on Linux

    Thank you for this awesome project! I think this is a really good starting point to learn USD & Hydra. This project helped me so much!

    There is a compile error on Linux. Since Linux has case sensitive file system, shadergen.* is not the same as ShaderGen.*. This caused CMake error and C++ compile error (because compiler cannot find shadergen.h header).

    Here is my solution for this error:

    • Rename shadergen.h and shadergen.cpp to ShaderGen.h and ShaderGen.cpp
    • In gatling/src/gi/src/gi.cpp, modify the included file name
  • Q: Custom BVH vs AccelerationStructure?

    Q: Custom BVH vs AccelerationStructure?

    I see that you removed your own BVH building and traversal and opted for built-in Vulkan AccelerationStructure BVH.

    Just out of curiosity, is the Vulkan AS giving better performance than your compressed wide BVH traversal that you had before? If so, what was the difference?

  • Running problems on the Mac platform

    Running problems on the Mac platform

    • In usdview
    export PYTHONPATH=/Users/usd-build/lib/python && export PATH=/Users/usd-build/bin:/Users/usd-build/lib:$PATH && usdview --renderer=Gatling /Users/gatling/cornell.usdc
    

    segmentation fault usdview --renderer=Gatling

    • Standalone
    /Users/gatling/cmake-build-relwithdebinfo/bin/gatling
    `HdGatling plugin is not supported!`
    

    Any help would be greatly appreciated.

    Aaron

🌞 A physically based monte carlo path tracer written in C++
🌞 A physically based monte carlo path tracer written in C++

Physically Based Path Tracer The below 3D model for the Head of Michelangelo's David bust was taken from this link. Other .obj files taken from The St

Nov 17, 2022
Brute force volumetric path tracer written in C++
Brute force volumetric path tracer written in C++

volpt Brute force volumetric path tracer written in C++. WIP. Features Homogeneous medium Hero wavelength sampling for chromatic absorption/scattering

Oct 21, 2022
A realtime Vulkan voxel path tracer.
A realtime Vulkan voxel path tracer.

brickmap-vulkan A realtime Vulkan voxel path tracer. This is a work in progress! This system is a Vulkan/SPIRV implementation of the BrickMap by stijn

Nov 3, 2022
ReferencePT - Supplemental code accompanying Ray Tracing Gems II, Chapter 14: The Reference Path Tracer
ReferencePT - Supplemental code accompanying Ray Tracing Gems II, Chapter 14: The Reference Path Tracer

The Reference Path Tracer Code sample This is a supplemental code accompanying Ray Tracing Gems II, Chapter 14: The Reference Path Tracer. Code is bas

Nov 21, 2022
Software ray tracer written from scratch in C that can run on CPU or GPU with emphasis on ease of use and trivial setup
Software ray tracer written from scratch in C that can run on CPU or GPU with emphasis on ease of use and trivial setup

A minimalist and platform-agnostic interactive/real-time raytracer. Strong emphasis on simplicity, ease of use and almost no setup to get started with

Oct 5, 2022
SVG animation from multiple SVGs or single GIF using tracer
SVG animation from multiple SVGs or single GIF using tracer

svgasm svgasm is a proof-of-concept SVG assembler to generate a self-contained animated SVG file from multiple still SVG files with CSS keyframes anim

Nov 22, 2022
Pathway is an Android library that provides new functionalities around the graphics Path API.

Pathway is an Android library that provides new functionalities around the graphics Path API.

Nov 30, 2022
PainterEngine is a application/game engine with software renderer,PainterEngine can be transplanted to any platform that supports C
PainterEngine is a application/game engine with software renderer,PainterEngine can be transplanted to any platform that supports C

PainterEngine is a application/game engine with software renderer,PainterEngine can be transplanted to any platform that supports C

Dec 1, 2022
Dissecting the M1's GPU for 3D acceleration

Asahi GPU Research for an open source graphics stack for Apple M1. wrap Build with the included makefile make wrap.dylib, and insert in any Metal appl

Nov 26, 2022
nsfminer is an Ethash GPU mining application: with nsfminer you can mine every coin which relies on an Ethash Proof of Work.

nsfminer (no stinkin' fees) Ethereum (ethash) miner with OpenCL, CUDA and stratum support nsfminer is an Ethash GPU mining application: with nsfminer

Sep 2, 2022
2D GPU renderer for dynamic UIs
2D GPU renderer for dynamic UIs

vger vger is a vector graphics renderer which renders a limited set of primitives, but does so almost entirely on the GPU. Works on iOS and macOS. API

Nov 26, 2022
This is a openGL cube demo program. It was made as a tech demo using PVR_PSP2 Driver layer GPU libraries.

OpenGL Cube Demo using PVR_PSP2 Driver layer GPU libraries This is a openGL cube demo program. It was made as a tech demo using PVR_PSP2 Driver layer

Oct 31, 2021
What I'm doing here is insane GPU driver prototype for @GreenteaOS
What I'm doing here is insane GPU driver prototype for @GreenteaOS

NjRAA Work-in-progress Driver Foundation [nee-jee-ray] What I'm doing here is a GPU driver for Linux as a prototype for future graphics stack of the @

Jan 22, 2022
Legion Low Level Rendering Interface provides a graphics API agnostic rendering interface with minimal CPU overhead and low level access to verbose GPU operations.
Legion Low Level Rendering Interface provides a graphics API agnostic rendering interface with minimal CPU overhead and low level access to verbose GPU operations.

Legion-LLRI Legion-LLRI, or “Legion Low Level Rendering Interface” is a rendering API that aims to provide a graphics API agnostic approach to graphic

Aug 13, 2022
A low-level, cross-platform GPU library

vgpu is cross-platform low-level GPU library. Features Support for Windows, Linux, macOS. Modern rendering using Vulkan and Direct3D12. Dependencies U

Jul 28, 2022
GPU cloth with OpenGL Compute Shaders
 GPU cloth with OpenGL Compute Shaders

GPU cloth with OpenGL Compute Shaders This project in progress is a PBD cloth simulation accelerated and parallelized using OpenGL compute shaders. Fo

Jul 27, 2022
GPU Texture Generator
GPU Texture Generator

Imogen GPU/CPU Texture Generator GPU Texture generator using dear imgui for UI. Not production ready and a bit messy but really fun to code. This is a

Nov 21, 2022
Optimized GPU noise functions and utilities

Optimized GPU noise functions and utilities

Dec 2, 2022
SMAA is a very efficient GPU-based MLAA implementation (DX9, DX10, DX11 and OpenGL)

SMAA is a very efficient GPU-based MLAA implementation (DX9, DX10, DX11 and OpenGL), capable of handling subpixel features seamlessly, and featuring an improved and advanced pattern detection & handling mechanism.

Nov 26, 2022