Jump to content

Ray tracing in an open world 2021.3 HDRP

Asset Glue
Go to solution Solved by Peter,

Recommended Posts

Preface: This is more of an observation and less of a piece for discussion. But feel free to contribute as I have only spent a few days on this particular facet of ray tracing in the current form of LTS Unity. There is a question at the end, TLDR.

The Unity terrain does not add to any of the DXR effects, however it can receive some of the lighting calculations. Its such an interesting problem. Mesh terrains can interact with DXR given the correct shader, however most of our favorite shaders do not support ray traced effects! 
Its worth to mention that DXR is still "Experimental" in the 2021.3 LTS.

With having that knowledge I still wanted to use GaiaPro to generate a small scene. So naturally I did. Then I converted it to a mesh terrain with LODS. And started applying camera restrictions and placing geometry.  But it was a mixed bag.

The shadows looked fantastic, Up close. And the higher the LOD level, then it was obvious that triangles were prominent and depending on the light angle of course. I had to resort to custom shaders. HDRPLit shader works. But not for water =(. Even my sky wouldn't reflect (Using Enviro), so I resorted to an HDRI to combat that.

The rendering time had already suffered from selecting DX12 as the preferred API. And after all of the effects were raytraced, the FPS was not useable for something interactive. And the second observation was that it did not look as good as rasterized effects. Not even the reflections. And to my disappointment, the shadows were horrible at a distance due to the LOD levels.

My test setup:
Terrain was 512x512 split into 32x32 chunks at 128 divisions per chunk. Rendering 115M triangles per frame. Additional geometry was a mere 40M triangles per frame.

I spent many hours, across days, with it. Using raytracing in a compute shader would have been more pleasing to look at and still offered an interactive framerate. 

One conclusion that I was able to understand, yet not grok completely, was that RTX in the respect to ray tracing is merely hardware acceleration for the BVH acceleration structure. To the best of my knowledge, this lends itself to the concept of a scene graph. So effects such as volumetric sky (ray marching in Enviro) are not accessible to the DXR hardware and would have to be implicitly built to accommodate such a scene graph or at least provide the surface properties at any given ray intersection for use in the rendering equation, in the form of BVH information that would allow the DXR hardware to sample surface properties of geometry. The unity terrain renderer also seems to posses such a limitation that it cannot give the surface properties at a given ray intersection. Or it does not feed those properties to the DXR hardware before it needed.

I am referring to the scene graph as the BVH representation of geometry and not the scene hierarchy in Unity Editor.

I am just so curious why the HDRPLit shader does supply the information and the terrain will not. I am also extremely curious as to why a mesh terrain of sufficient density (100+ M triangles visible) still provides shadows which end up as triangles. (I am pretty sure that the terrain is attempting to defer rendering because of overdraw)

And so I do understand that this is Canopy, Procedural Worlds forum for discussion. However I do find it relevant to discuss given the "Preface" and the "TLDR". 

Thank you for any constructive input.

TLDR: Has anyone been able to get Ray Tracing to work for something other than a Cornell Box (Scene graph in a semi-closed world system), and have I completely missed the target on RTX or DXR.  ? <--- that is where the discussion is relevant.



Link to comment
Share on other sites

I just figured out that the triangle density of the mesh that is represented to the DXR hardware is the reason why it does not play well. Any constructive input is still valid. Its an ongoing question.


Link to comment
Share on other sites

  • 6 months later...

So far I cant get any terrain to stamp under dx12 and RTX on unity 2022.2.0b16.
I can see the preview, but when I press stamp, I just get these errors.spacer.png






Ultimately leading to a long process time and eventual crash of the editor.


Info from the Gaia Pro System & product info window.



I have restarted a few times now with the same results.
I am going to load a non RTX setup and see if I get the same thing on that.

Thank You.

Link to comment
Share on other sites

Hi @Myke Price, when you try again, can you please try to not use the beta version of 2022.2, but rather the latest 2022.2.2 release? The Gaia version 3.3.4 was adapted to 2022.2 when it came out of beta, there is a slim chance that the errors you are seeing are related to the beta version of Unity.

Link to comment
Share on other sites

Ok, an update, I tried 2022.2.0f1 In dx12 and DX11 in HDRP and neither one of those would stamp a terrain for me.

I am now back at 2021.3.11f1 in DX11 and I am able to stamp the terrain.

Link to comment
Share on other sites

OK, the pictures look nice, But I have a few questions. Still in version 2022.2.0f1 DX12 with what I had ray tracing enabled. No errors in the HDRP wizard panel.

I used the GAIA HDRP settings (recommended) when installing the package update GAIA 3.3.5-c5.
Set up the quick test scene above, all looks nice.

Open the HDRP wizard out of curiosity today and am seeing these messages to fix or add certain dx12 settings again.


Finally the question for you. Should I just ignore the HDRP wizard warnings and just use what your default HDRP profile is, or should I fix these errors, and if I do, will they destroy what your setting make right?

Wizard screen caps of messages after using the GAIA recommend HDRP setting:







Link to comment
Share on other sites

  • Solution

Hi, the Gaia HDRP render pipeline settings asset is derived from the default HDRP pipeline asset and contains some baseline settings that are either required for certain features of Gaia to work, or to avoid known issues / problems in a common outdoors terrain scene. The settings that we change from the default HDRP asset are:

Terrain Hole OFF => ON
Decals - Atlas Width / Height 2048 => 4096
Decals - Metal and AO Properties ON => OFF
Additive Normal Blending OFF => ON
Lighting - SSGI OFF => ON
Volumetrics - Volumetric Clouds OFF => ON
Cookies - 2D Atlas Size 512 => 2048
Reflections - SSR OFF => ON
Reflections - SSR - Transparent OFF => ON
Reflections - Probe Cache Size 32 => 64
Reflections - Maximum Reflection Probes on Screen 32 => 64
Sky - Reflection Size 512 => 256
Shadows - Directional Light Shadows - Precision 16 => 32

We also add our own diffusion profiles to the diffusion profile list so that the Gaia vegetation shaders display correctly. We also aim to make it so that the "regular" HDRP tab of the HDRP wizard does not show any errors. The VR and DXR tab we currently do not optimize for as we do not want to push the users configuration towards VR or DXR without them knowing / wanting that.
It should be safe to let the HDRP wizard fix the errors / warnings in the DXR tab after the Gaia Pipeline switch.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

  • Create New...