Getting Started with RTX Ray Tracing

Overview

Getting Started with RTX Ray Tracing

This directory contains Chris Wyman's shader tutorials from the GDC 2019 and SIGGRAPH 2018 courses "Introduction to DirectX Raytracing". Visit the SIGGRAPH course webpage to get more details, more descriptive code walkthroughs, some prebuilt tutorial binaries, course presentations, and other information about the course.

Please read this document carefully before trying to build our tutorials. Given DirectX Raytracing is new, building code that relies on it can easily break in surprising ways if you do not have the latest requirements. We have tried to specify all requirements and caveats, to avoid pain in getting started, and we will update this tutorial code as requirements change. Please contact us or log an issue if you run into unexpected troubles not covered below.

Also note: None of the tutorial examples are intended to demonstrate best practices for highly optimized performance. These samples are optimized to provide an easy starting point, clarity, and general code readability (rather than performance).

Source code for our tutorials and shaders is licensed under a BSD license. Models, textures, and other resources have their own licenses (see 'Acknowledgments' below).

Software/Hardware Requirements:

  1. This code.
    • If you clone this repository using a command window, please use the standard Windows CMD window, not a Linux shell, which can alter the CR/LF in project files and make them fail with errors such as "c1xx : fatal error C1083: Cannot open source file: '..\SharedUtils\FullscreenLaunch.cpp': No such file or directory" and similar when building the code.
  2. Windows 10 RS5.
    • If you run "winver.exe" you should see Version 1809 (OS Build 17763) or later.
    • See older versions of this repository for unsupported code that runs on RS4 (v1803).
  3. Microsoft Visual Studio 2017.
  4. Windows 10 SDK 10.0.17763.0 (aka Windows 10 SDK, version 1809).
    • Download SDK
    • Note: Later SDK versions probably work, but you need to change each Visual Studio project to look for the SDK you download, rather than 10.0.17763.0.
  5. A graphics card supporting DirectX Raytracing.
  6. An NVIDIA driver that natively supports DirectX Raytracing.
    • Includes most public drivers version 400 or later.
    • We recommend updating to recent drivers to provide highest performance and stability when ray tracing.
  7. Make sure you get Falcor from (https://github.com/NVIDIAGameWorks/Falcor) and checkout the commit tagged v3.1 (commit 5a12f298c15b82297447906afafdcf5a2f58f99e).
    • The repo should be setup with a submodule to do this automatically.
    • This version of Falcor should reside in the Falcor/ subdirectory of the GettingStartedWithRTXRayTracing repository.
    • If compiling gives a bunch of undefined references and cast conversion errors, you have the wrong version of Falcor.
    • We plan to update these tutorials once more for Falcor 4.0, perhaps including as part of the distribution.
  8. Make sure to build a "ReleaseD3D12" (or "DebugD3D12") version of the samples.

Getting started:

Satisfying the requirements above, you're ready to get started.

You should be able to install the tutorials directory almost anywhere. However, we have run into problems with the build scripts if the install directory contains spaces. For now, we suggest avoiding that.

Before compiling, you need to include Falcor and download Falcor dependencies. Falcor itself is downloaded by the link on the Github page for these Getting Started program, which currently leads to this Falcor 3.1 repo. If not done automatically, download and put these files in the Falcor/ directory.

Next, run update_dependencies.bat in the Falcor/ directory. It should download a bunch of packages and put them in Falcor/Framework/Externals/ and Falcor/Media/. The Visual Studio solution will call this script for you via a pre-build step, but it sometimes gives confusing error messages when starting a parallel build. This is not a problem if you run the script manually.

Now open the Visual Studio solution GettingStartedWithRTXRayTracing.sln. We suggest you initially choose the "ReleaseD3D12" configuration to begin, as programs will start up and run faster. Then "Build | Build Solution" to build all the tutorial programs. In the Solution Explorer you right-click and choose "Set as StartUp Project" to run that tutorial.

Most tutorials load a default scene (the "modern living room" from Benedikt Bitterli's page). We also include one other simple scene in directory Falcor/Media/Arcade/. Additional, more complex scenes can be downloaded from the Open Research Content Archive:

Troubleshooting:

Visual Studio gives "Error MSB3073" when building. This is an issue with the pre-build step, and we've seen it in the following cases:

  • The installation directory name (or parent directories) contains a space.
  • You ran a parallel build; our pre-build script gets called for each tutorial and fails on all except the first. This is usually a one-time error and rebuilding solves the problem.
  • There are installation problems with the dependencies. Remove the "Falcor/Media/" directory and all subdirectories in the Falcor/Framework/Externals/ directory (you can do this with delete_dependencies.bat) and rerun update_dependencies.bat in the Falcor/ directory.

Visual Studio gives "c1xx : fatal error C1083: Cannot open source file: '..\SharedUtils\FullscreenLaunch.cpp': No such file or directory" or similar when building. As noted in step 0, cloning the repository with Git under certain shells such as Ubuntu can cause problems with end of line characters and so alter project files. Use the Windows CMD command prompt, or if all else fails, download the zip.

Tutorial Information:

Note the UI has a number of slightly-hidden features. Hover your mouse over the "(?)" next to "Keyboard Shortcuts" at the top of the menu on the left to see some useful key shortcuts. "Global Controls" can be viewed by clicking on the small arrow to the left of this text.

The mouse orbits and WASD moves the camera through the scene, along with Q and E for down and up. Camera movement can be made slower by holding down "Ctrl" and faster by holding down "Shift."

Each tutorial demonstrates how to implement some basic rendering algorithm. Much of the focus of each is the set of shaders in the Shaders directory. You are encouraged to modify these shaders and the rest of the code as you wish. One nice feature of the Falcor framework is that you can modify and reload the shaders without restarting the program. While focused on the program, press F5 and then change the view or toggle some feature that causes a refresh. The new shaders should then take effect.

Additional Resources for DirectX Raytracing:

Chris has a code walkthrough for his shader tutorials. You can download most of the prebuilt binaries (please read the readme to avoid issues; also, does not include the Sphereflake demo).

Other useful resources:


Acknowledgments:

The desert HDR environment map (MonValley Dirtroad) is provided from the sIBL Archive under a Creative Commons license CC BY-NC-SA 3.0 US.

The included "pink_room" scene is named 'The Modern Living Room' by Wig42 on Benedikt Bitterli's webpage. It has been modified to match the Falcor material system. This scene was released under a CC-BY license. It may be copied, modified and used commercially without permission, as long as: Appropriate credit is given to the original author The original scene file may be obtained here.

The moon texture came from here under CC BY 4.0 license.

The earth texture is public domain from here.

The normal map texture is licensed CC0 from here.

Comments
  • Can't find xxx.cpp

    Can't find xxx.cpp

    I just got my RTX 2080 Ti installed and I'm trying to run some ray tracing examples. I have Windows 10 1803 build 17134 and Visual Studio 2017 Pro completely up-to-date with the latest Windows SDK.

    I cloned a fresh copy of the examples here, ran the update_dependencies.bat file inside the Falcor folder and then tried to build. I tried Debug and Release 64bit but I'm getting weird errors about the compiler not being able to find any of the example cpp files, yet they are there and I can open them.

    I have attached the full log.

    errors.txt

    opened by SirKnightTG 22
  • Can`t build when download python

    Can`t build when download python

    Fetching [email protected]_32.zip from S3 ... Connecting to S3 ... Downloading ... Unpacking Python interpreter ...

    How to solve the problem? Thanks.

    opened by bailehang 6
  • Sphereflake

    Sphereflake

    CaptureErr2 CaptureError

    Any chance that someone would fix the Sphereflake demo ? I tried to manually add the raytraced AABB and fix all errors. But still, even after successful compilation, the executable complains and I have truly no idea what's the problem. Or anyone already tried and could point me on the right direction ? Having that demo running would be astonishing, especially from the claim from the blog of the 48 million spheres...

    opened by corredD 3
  • Package '7za' at version '16.02.2' is missing from local storage

    Package '7za' at version '16.02.2' is missing from local storage

    When i was running 'update_dependencies.bat', cmd reported this. I searched for this issues on last project 'NVIDIAGameWorks/Falcor', halldorfannar told to update packman to 5.1. Should i download 'NVIDIAGameWorks/Falcor' package to solve this?

    opened by BigNoobDog 2
  • Update tutorials for Windows 10 RS5+ and using public Github Falcor v. 3.1.0

    Update tutorials for Windows 10 RS5+ and using public Github Falcor v. 3.1.0

    Includes fairly extensive code modifications based on Falcor changes from the precompiled RS4 to public version 3.1.0. (Code requires further updates for Falcor 3.2+. Changes to the tutorials already done for internal, unreleased Falcor 4.0, so I'm not going to update again until Falcor 4.0 releases.)

    Include HLSL shader updates for DXR changes from RS4 experimental -> RS5 final release.

    Removes 'Ray Tracing in One Weekend' and "Sphereflake' demos which, sadly, aren't yet supported on public versions of Falcor (no support yet for non-triangle geometry)

    Removes precompiled Falcor. Adds submodule reference for Github-based Falcor v 3.1.

    Updates solution and project files for updated RS5-version of Windows 10 SDK, changes to required Falcor, and streamlining of the build process.

    Update the readme to update instructions and remove references to removed sphereflake and ray tracing in one weekend demos.

    enhancement 
    opened by chris-wyman 0
  • About VS2019 version compiling Falcor3.2 error problem

    About VS2019 version compiling Falcor3.2 error problem

    You may encounter the problem of "Cannot find Falcor.lib" during the process of generating the solution. This is because when compiling the Falcor project, there will be an error: "C1189 #error: The <experimental/filesystem> header providingstd: "experimental::filesystem is deprecated by Microsoft and will be REMOVED. It is superseded by the C++17 header providing std::filesystem. You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to acknowledge that you have received this warning. (Compile source file Experimental\RenderGraph\RenderGraphUI.cpp) Falcor D:\VS2019\VC\Tools\MSVC\14.29.30133\include\experimental\filesystem 30"and "C4244 "Parameter": Convert from "wchar_t" to "const _Elem", may lose data FalcorD:\VS2019\VC\Tools\MSVC\14.29.30133\include\xstring 2575" error warning". The solution to the first problem above: you need to add in the include item: _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to Preprocessor definitions. Project -> Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions. The second question: In the project that contains warnings, right-click Properties-C/C++-General-Treat warnings as errors-change to "No". After the Falcor solution is modified by the above method, it can be compiled. For the second question, I don't know if there is any problem with this modification.

    opened by chnth 6
  • why you don't provide the source of Mesh::createFromBoundingBoxBuffer ?

    why you don't provide the source of Mesh::createFromBoundingBoxBuffer ?

    because of that it's not possible to compile or start the DXR-RayTracingInOneWeekend and DXR-Sphereflake sample as the source had not been updated ...

    opened by surfufu 2
  • Bad getPerpendicularVector usage

    Bad getPerpendicularVector usage

    This particular method of generating a perpendicular vector doesn't return a unit vector in most cases, so the following line (as well as line 137) should normalize() the result, otherwise you'll end up with a different distribution of rays than the one that's intended:

    https://github.com/NVIDIAGameWorks/GettingStartedWithRTXRayTracing/blob/f1946147ea50987efd4e897d8bb996e2f8bc99df/12-DiffuseGlobalIllumination/Data/Tutorial12/simpleDiffuseGIUtils.hlsli#L121

    This is just something I happened across while skimming the code quickly, so I haven't looked for other uses elsewhere in this sample or the others.

    It's maybe not a horrendous error, since a quick test suggests that the mean norm is ~0.96, but the worse case can be ~0.82.

    opened by shill-lucasfilm 2
  • Error C2220 happening when system language is not English

    Error C2220 happening when system language is not English

    image Hi, The tutorial is awesome, but when I built the project, some C2220 errors happened and I can't build successfully. Finally, I figure out that I use simplified Chinese Windows system language and it might change some characters within the files. So you might want to tell people to use English system when they clone the project. By the way, I figure out this problem by save the files as encoding and set the file to be unicode.

    opened by HC-Mark 0
  • Error with GGXGlobalIllumination - uint/int

    Error with GGXGlobalIllumination - uint/int

    The GGX GI demo works, but every frame you get a popup saying: "Error when setting variable at offset 16. Type mismatch. Expecting Uint but the user provided a Int"

    To fix this, I went into GGXGlobalIlluminationPass::execute() and added a cast to uint32_t for gMaxDepth like so: globalVars["GlobalCB"]["gMaxDepth"] = (uint32_t)mUserSpecifiedRayDepth;

    No more error.

    I tried changing mUserSpecifiedRayDepth to uint32_t in the class definition, but then Gui::addIntVar complained.

    opened by SirKnightTG 2
Owner
NVIDIA GameWorks
NVIDIA Technologies for game and application developers
NVIDIA GameWorks
A path tracer based on hardware ray tracing

GoldenSun GoldenSun is a GPU path tracer. It uses hardware ray tracing APIs to do the tracing. As an experimental project, there is no release plan, n

Minmin Gong 20 Feb 27, 2022
A toy renderer written in C using Vulkan to perform real-time ray tracing research.

This is a toy renderer written in C using Vulkan. It is intentionally minimalist. It has been developed and used for the papers "BRDF Importance Sampl

Christoph Peters 290 Dec 19, 2022
This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX

Apress Source Code This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX by Adam Marrs, Peter Shirley

Apress 684 Dec 29, 2022
My implementations of Ray Tracing in One Weekend written in many different languages.

Ray Tracing in Many Languages This repository contains my implementation of the Ray Tracing in One Weekend book written in several different programmi

Joshua Vega 1 Oct 19, 2021
Implementation of light baking system for ray tracing based on Activision's UberBake

Vulkan Light Bakery MSU Graphics Group Student's Diploma Project Treefonov Andrey [GitHub] [LinkedIn] EARLY STAGES OF DEVELOPMENT Project Goal The goa

Andrei Treefonov 7 Dec 27, 2022
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

Jakub Boksansky 153 Dec 20, 2022
Source Code for "Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs" by Eric Haines and Tomas Akenine-Möller

Apress Source Code This repository accompanies Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs by Eric Haines and Tomas

Apress 862 Dec 29, 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

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

Arnon Marcus 48 Dec 28, 2022
Implementation of Peter Shirley's Ray Tracing In One Weekend book using Vulkan and NVIDIA's RTX extension.

Ray Tracing In Vulkan My implementation of Peter Shirley's Ray Tracing in One Weekend books using Vulkan and NVIDIA's RTX extension (formerly VK_NV_ra

Tanguy Fautre 862 Dec 31, 2022
Getting started with uefi

Hello UEFI 此项目是uefi入门实践指导,因为我也是一路踩坑踩过来,所以想要记录一下。 UEFI开发环境搭建非常的复杂。 linux和windows和其他操作系统上都可以编译,这里主要讲windows。 此项目完成的效果仅仅是使用我们开发的uefi模块,在vmware上测试,并在shell

0000000000 2 Nov 8, 2021
Just getting started with Data Structure and Algorithms? Make your first contribution here and start the journey of learning DSA.

Getting Started ! ✨ If you are just beginning with open source then let's make your first contribution in this repository ! Contributing Tutorial ?? P

amega 3 Apr 18, 2022
3D ray-tracing and animation engine for pixel matrices.

ProtoTracer: Protogen Ray-Tracing and Animation Engine This project is a 3D ray-tracing and animation engine for pixel matrices, designed to be used f

Open Protogen 86 Dec 20, 2022
A path tracer based on hardware ray tracing

GoldenSun GoldenSun is a GPU path tracer. It uses hardware ray tracing APIs to do the tracing. As an experimental project, there is no release plan, n

Minmin Gong 20 Feb 27, 2022
A toy renderer written in C using Vulkan to perform real-time ray tracing research.

This is a toy renderer written in C using Vulkan. It is intentionally minimalist. It has been developed and used for the papers "BRDF Importance Sampl

Christoph Peters 290 Dec 19, 2022
This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX

Apress Source Code This repository accompanies Ray Tracing Gems II: Next Generation Rendering with DXR, Vulkan, and OptiX by Adam Marrs, Peter Shirley

Apress 684 Dec 29, 2022
A sample demonstrating hybrid ray tracing and rasterisation for shadow rendering and use of the FidelityFX Denoiser.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

GPUOpen Effects 54 Dec 3, 2022
GPU ray tracing framework using NVIDIA OptiX 7

GPU ray tracing framework using NVIDIA OptiX 7

Shunji Kiuchi 27 Dec 22, 2022
My implementations of Ray Tracing in One Weekend written in many different languages.

Ray Tracing in Many Languages This repository contains my implementation of the Ray Tracing in One Weekend book written in several different programmi

Joshua Vega 1 Oct 19, 2021
Final Project for Multicore Processors Course at NYU: Parallel Ray Tracing Algorithm

Multicore_ParallelRayTracing Final Project for Multicore Processors Course at NYU: Parallel Ray Tracing Algorithm Team Member: Hanlin He, Yaowei Zong,

Hanlin || Herlin 1 Dec 1, 2021
A C++-based, cross platform ray tracing library

Visionaray A C++ based, cross platform ray tracing library Getting Visionaray The Visionaray git repository can be cloned using the following commands

Stefan Zellmann 409 Dec 29, 2022