Git Product home page Git Product logo

gatling's Introduction

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 (2022.0+) binaries
  • download or build USD (22.08+) 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.

gatling's People

Contributors

aaronmack avatar pablode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatling's Issues

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?

Arch Linux Build

Hi, I'm looking to build your renderer in Arch Linux.

Note: I disabled the externals so I can use the system dependencies

Build commands:

cmake .. -Wno-dev -DUSD_ROOT=/usr/share/usd -DMDL_ROOT=/mnt/proj/dep/mdl-sdk -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/share/usd -DCMAKE_PREFIX_PATH=/usr
cmake --build . -j2 --target hdGatling gatling --config Release

I have two errors, one building from gcc 13 and the other from clang 15:

GCC

[ 98%] Building CXX object src/hdGatling/CMakeFiles/hdGatling.dir/Tokens.cpp.o
In file included from /usr/include/c++/13.2.1/ext/hash_set:60,
                 from /usr/share/usd/include/pxr/base/tf/hashset.h:39,
                 from /usr/share/usd/include/pxr/base/tf/token.h:37,
                 from /usr/share/usd/include/pxr/base/tf/staticTokens.h:82,
                 from /mnt/proj/dev/gatling/src/hdGatling/Tokens.h:20,
                 from /mnt/proj/dev/gatling/src/hdGatling/Tokens.cpp:18:
/usr/include/c++/13.2.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
   32 | #warning \
      |  ^~~~~~~
In file included from /usr/include/c++/13.2.1/ext/hash_set:64:
/usr/include/c++/13.2.1/backward/hashtable.h: In instantiation of ‘__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::size_type __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::_M_bkt_num_key(const key_type&, std::size_t) const [with _Val = std::pair<const std::__cxx11::basic_string<char>, unsigned int>; _Key = std::__cxx11::basic_string<char>; _HashFcn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; _ExtractKey = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int> >; _EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<unsigned int>; size_type = long unsigned int; key_type = std::__cxx11::basic_string<char>; std::size_t = long unsigned int]’:
/usr/include/c++/13.2.1/backward/hashtable.h:596:30:   required from ‘__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::size_type __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::_M_bkt_num_key(const key_type&) const [with _Val = std::pair<const std::__cxx11::basic_string<char>, unsigned int>; _Key = std::__cxx11::basic_string<char>; _HashFcn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; _ExtractKey = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int> >; _EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<unsigned int>; size_type = long unsigned int; key_type = std::__cxx11::basic_string<char>]’
/usr/include/c++/13.2.1/backward/hashtable.h:519:32:   required from ‘__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::iterator __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::find(const key_type&) [with _Val = std::pair<const std::__cxx11::basic_string<char>, unsigned int>; _Key = std::__cxx11::basic_string<char>; _HashFcn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; _ExtractKey = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int> >; _EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<unsigned int>; iterator = __gnu_cxx::hashtable<std::pair<const std::__cxx11::basic_string<char>, unsigned int>, std::__cxx11::basic_string<char>, __gnu_cxx::hash<std::__cxx11::basic_string<char> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<unsigned int> >::iterator; key_type = std::__cxx11::basic_string<char>]’
/usr/include/c++/13.2.1/ext/hash_map:213:26:   required from ‘__gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqualKey, _Alloc>::iterator __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqualKey, _Alloc>::find(const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = unsigned int; _HashFn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; _EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<unsigned int>; iterator = __gnu_cxx::hashtable<std::pair<const std::__cxx11::basic_string<char>, unsigned int>, std::__cxx11::basic_string<char>, __gnu_cxx::hash<std::__cxx11::basic_string<char> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<unsigned int> >::iterator; key_type = std::__cxx11::basic_string<char>]’
/usr/share/usd/include/pxr/base/tf/hashmap.h:118:60:   required from ‘pxrInternal_v0_23__pxrReserved__::TfHashMap<Key, Mapped, HashFn, EqualKey, Alloc>::iterator pxrInternal_v0_23__pxrReserved__::TfHashMap<Key, Mapped, HashFn, EqualKey, Alloc>::find(const key_type&) [with Key = std::__cxx11::basic_string<char>; Mapped = unsigned int; HashFn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; Alloc = std::allocator<unsigned int>; iterator = __gnu_cxx::hashtable<std::pair<const std::__cxx11::basic_string<char>, unsigned int>, std::__cxx11::basic_string<char>, __gnu_cxx::hash<std::__cxx11::basic_string<char> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<unsigned int> >::iterator; key_type = std::__cxx11::basic_string<char>]’
/mnt/proj/dev/gatling/src/hdGatling/RenderPass.cpp:468:50:   required from here
/usr/include/c++/13.2.1/backward/hashtable.h:604:23: error: no match for call to ‘(const __gnu_cxx::hashtable<std::pair<const std::__cxx11::basic_string<char>, unsigned int>, std::__cxx11::basic_string<char>, __gnu_cxx::hash<std::__cxx11::basic_string<char> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<unsigned int> >::hasher {aka const __gnu_cxx::hash<std::__cxx11::basic_string<char> >}) (const __gnu_cxx::hashtable<std::pair<const std::__cxx11::basic_string<char>, unsigned int>, std::__cxx11::basic_string<char>, __gnu_cxx::hash<std::__cxx11::basic_string<char> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<unsigned int> >::key_type&)’
  604 |       { return _M_hash(__key) % __n; }
      |                ~~~~~~~^~~~~~~
make[3]: *** [src/hdGatling/CMakeFiles/hdGatling.dir/build.make:258: src/hdGatling/CMakeFiles/hdGatling.dir/RenderPass.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:359: src/hdGatling/CMakeFiles/hdGatling.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:366: src/hdGatling/CMakeFiles/hdGatling.dir/rule] Error 2
make: *** [Makefile:234: hdGatling] Error 2

Clang

[100%] Linking CXX shared library ../../bin/hdGatling.so
/usr/bin/ld: ../../bin/libgi.a: error adding symbols: file format not recognized
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [src/hdGatling/CMakeFiles/hdGatling.dir/build.make:378: bin/hdGatling.so] Error 1
make[2]: *** [CMakeFiles/Makefile2:359: src/hdGatling/CMakeFiles/hdGatling.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:366: src/hdGatling/CMakeFiles/hdGatling.dir/rule] Error 2
make: *** [Makefile:234: hdGatling] Error 2

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

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

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?

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

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 `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.