Giter Site home page Giter Site logo

xiang8420 / chameleonrt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from twinklebear/chameleonrt

0.0 0.0 0.0 2.21 MB

An example path tracer that runs on multiple ray tracing backends (Embree/DXR/OptiX/Vulkan/Metal/OSPRay)

License: MIT License

C++ 78.96% C 16.82% Objective-C 0.03% Objective-C++ 1.40% Cuda 0.21% CMake 0.83% GLSL 0.42% Metal 0.72% HLSL 0.60%

chameleonrt's Introduction

ChameleonRT

CMake

An example path tracer that runs on multiple ray tracing backends (Embree/DXR/OptiX/Vulkan/Metal/OSPRay). Uses tinyobjloader to load OBJ files, tinygltf to load glTF files and, optionally, Ingo Wald's pbrt-parser to load PBRTv3 files. The San Miguel, Sponza and Rungholt models shown below are from Morgan McGuire's Computer Graphics Data Archive.

Binaries built for each platform with support for all rendering backends available on that platform can be downloaded from the Releases or the latest Actions artifacts. On Linux set the LD_LIBRARY_PATH to include the directory where you extract the application, on macOS do the same for DYLD_LIBRARY_PATH. On macOS you may need to do some tweaking/security allowances to get the application to run. Only x86_64 binaries are provided for macOS at the moment.

San Miguel, Sponza and Rungholt

Controls

The camera is an arcball camera that moves around the camera's focal point.

  • Zoom in/out using the mousewheel. (Two-finger scroll motion on MacBook Pro etc. trackpad.)
  • Click and drag to rotate.
  • Right-click and drag to pan. (Two-finger click and drag on MacBook Pro etc. trackpad.)

Keys while the application window is in focus:

  • Print the current camera position, center point, up vector and field of view (FOV) to the terminal by pressing the p key.
  • Save image by pressing the s key.

Command-line Options

-eye <x> <y> <z>       Set the camera position
-center <x> <y> <z>    Set the camera focus point
-up <x> <y> <z>        Set the camera up vector
-fov <fovy>            Specify the camera field of view (in degrees)
-camera <n>            If the scene contains multiple cameras, specify which
                       should be used. Defaults to the first camera
-img <x> <y>           Specify the window dimensions. Defaults to 1280x720

Ray Tracing Backends

The currently implemented backends are: Embree, DXR, OptiX, Vulkan, and Metal. When running the program, you can pick which backend you want from those you compiled with on the command line. Running the program with no arguments will print help information.

./chameleonrt <backend> <mesh.obj/gltf/glb>

All five ray tracing backends use SDL2 for window management and GLM for math. If CMake doesn't find your SDL2 install you can point it to the root of your SDL2 directory by passing -DSDL2_DIR=<path>. GLM will be automatically downloaded by CMake during the build process.

To track statistics about the number of rays traced per-second run CMake with -DREPORT_RAY_STATS=ON. Tracking these statistics can impact performance slightly.

ChameleonRT only supports per-OBJ group/mesh materials, OBJ files using per-face materials can be reexported from Blender with the "Material Groups" option enabled.

To build with PBRT file support set the CMake option CHAMELEONRT_PBRT_SUPPORT=ON and pass -DpbrtParser_DIR=<path> with <path> pointing to the CMake export files for your build of Ingo Wald's pbrt-parser.

Embree

Dependencies: Embree, TBB and ISPC.

To build the Embree backend run CMake with:

cmake .. -DENABLE_EMBREE=ON \
	-Dembree_DIR=<path to embree-config.cmake> \
	-DTBB_DIR=<path TBBConfig.cmake> \
	-DISPC_DIR=<path to ispc>

You can then pass embree to use the Embree backend. The TBBConfig.cmake will be under <tbb root>/cmake, while embree-config.cmake is in the root of the Embree directory.

OptiX

Dependencies: OptiX 7.2, CUDA 11.

To build the OptiX backend run CMake with:

cmake .. -DENABLE_OPTIX=ON

You can then pass optix to use the OptiX backend.

If CMake doesn't find your install of OptiX you can tell it where it's installed with -DOptiX_INSTALL_DIR.

DirectX Ray Tracing

If you're on Windows 10 1809 or higher, have the latest Windows 10 SDK installed and a DXR capable GPU you can also run the DirectX Ray Tracing backend.

To build the DXR backend run CMake with:

cmake .. -DENABLE_DXR=ON

You can then pass dxr to use the DXR backend.

Vulkan KHR Ray Tracing

Dependencies: Vulkan (SDK 1.2.162 or higher)

To build the Vulkan backend run CMake with:

cmake .. -DENABLE_VULKAN=ON

You can then pass vulkan to use the Vulkan backend.

If CMake doesn't find your install of Vulkan you can tell it where it's installed with -DVULKAN_SDK. This path should be to the specific version of Vulkan, for example: -DVULKAN_SDK=<path>/VulkanSDK/<version>/

Metal

Dependencies: Metal and a macOS 11+ device that supports ray tracing.

To build the Metal backend run CMake with:

cmake .. -DENABLE_METAL=ON

You can then pass metal to use the Metal backend.

OSPRay

Dependencies: OSPRay 2.0, TBB.

To build the OSPRay backend run CMake with:

cmake .. -DENABLE_OSPRAY=ON -Dospray_DIR=<path to osprayConfig.cmake>

You may also need to specify OSPRay's dependencies, ospcommon and OpenVKL, depending on how you got or built the OSPRay binaries. If you downloaded the OSPRay release binaries, you just need to specify that path.

You can then pass ospray to use the OSPRay backend.

Citation

If you find ChameleonRT useful in your work, please cite it as:

@misc{chameleonrt,
	author = {Will Usher},
	year = {2019},
	howpublished = {\url{https://github.com/Twinklebear/ChameleonRT}},
	title = {{ChameleonRT}}
} 

chameleonrt's People

Contributors

twinklebear avatar ctsrc avatar

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.