Skip to content

Script to toggle Ray Tracing and DLSS in Unity's HDRP.

License

Notifications You must be signed in to change notification settings

Kfollen93/HDRP-Ray-Tracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HDRP Ray Tracing Template

Template script to toggle buttons for Ray Tracing, and as an extra, DLSS Modes (Max Quality, Balanced, Max Performance) via a keypress toggle.

Description

While I am in the finishing stretch for a URP project that I have been working on for several months, I got distracted by Unity's recent 2022.2 Tech Stream release. I have only worked with the built-in render pipeline and the URP. However, all of the new features in 2022.2 and the HDRP in general has interested me for some time. If my next game ends up utilizing the HDRP, then I will certainly be using DX12 and Ray Tracing. Therefore, the script here is intended to be used as a resource for getting you started with toggling Ray Tracing settings in Unity's HDRP.

How to Use

You will need to be in a HDRP project with all of the DXR settings enabled (and DLSS if you want to use it). Once your project is set up for Ray Tracing, you can then create an empty GameObject and place the script from this repo on it. From there, it's simply a drag and drop of all the required components.

One of those required components is a Volume Profile. To utilize all of the Ray Tracing features, this Volume should include: Screen Space Global Illumination, Screen Space Reflection, and Screen Space Ambient Occlusion. An error will be thrown if one of those overrides are not included on the Volume; feel free to remove this requirement if you don't want it.

After dragging in the main camera, profile, and the TMP_Text components (each TMP Button has a TMP_Text child component), you need to add an On Click () event to each corresponding button, drag in the GameObject that is holding the GraphicalStats.cs script, and select the corresponding method for each button. As an example, if you name your button RT Reflections Button then the event should reference the OnButtonClick_ToggleRTReflections(), and so on. Lastly, you will need to have the Unity UI Event System in your hierarchy for on click events.

Additional Information

  • Made with: Unity 2022.2.1f1 (HDRP)
  • - It's likely some settings will change when 2022.3 arrives.
  • Hardware Used: RTX 3080.

About

Script to toggle Ray Tracing and DLSS in Unity's HDRP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages