Skip to content

Hydra-enabled GPU path tracer that supports MaterialX and MDL

License

Notifications You must be signed in to change notification settings

pablode/gatling

Repository files navigation

gatling

Evermotion Kitchen

Evermotion Scene 06 AI48, rendered in Gatling using Blender's Hydra/MaterialX support.

Porsche 911 GT3

Porsche 911 GT3, modified with materials from the GPUOpen MaterialX library.

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. It is cross-platform*, GPU-accelerated, and implements the MaterialX, NVIDIA MDL and UsdPreviewSurface material standards.

Complex BSDFs like OpenPBR, Autodesk's Standard Surface, and the glTF shading model are supported using MaterialX and its MDL code generation backend. The MDL SDK is used to generate evaluation and importance sampling functions as GLSL code, which is compiled to SPIR-V and executed with Vulkan.

* Hardware ray tracing is required. MacOS will be supported in the future.

Build

There are prebuilt binaries which can be copied to the <USD_INSTALL>/plugin/usd directory.

Alternatively, for a full source build you need to

  • download the MDL SDK 2023.0.4 binaries
  • download or build USD 24.03 with MaterialX support

Note: it is recommended to have NASM 2.13+ or YASM 1.2.0+ in your PATH to speed up image decoding.

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=<USD_INSTALL_DIR> \
         -DMDL_ROOT=<MDL_INSTALL_DIR> \
         -DCMAKE_INSTALL_PREFIX=<USD_INSTALL_DIR>/plugin/usd
         -DCMAKE_BUILD_TYPE=Release

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

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

Usage

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

Alex Treviño's Junk Shop (CC BY), distilled to UsdPreviewSurfaces, rendered within usdview.

A headless standalone is provided that accepts a USD file (.usd, .usda, .usdc, .usdz) as input. It exposes the Hydra render settings as command line arguments:

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

Note: high sample counts may require adjusting the system watchdog settings.

Issues

  • Features: certain USD prim types (curves, cylinder lights), APIs (UsdLuxShapingAPI, UsdLuxShadowAPI) and features (GeomSubset, subdivision) are not yet supported. UDIM textures, volumes, displacement and other rendering features have yet to be implemented.

  • Arbitrary primvar reading: Gatling currently does not implement MDL scene data, which means that MaterialX geompropvalue and UsdPreviewSurface UsdPrimvarReader nodes are unsupported.

  • Real-time editing: changing material parameters, transforming meshes or instances, and adjusting render settings currently result in full or partial cache rebuilds.

License

Gatling is licensed under the GNU General Public License, as included in the LICENSE file.


    Copyright (C) 2019 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 <https://www.gnu.org/licenses/>.

Licenses of third-party code and libraries are listed in the same file.