Ray Tracing Foliage in UE4

Hey all, wanted to bring your attention to our development efforts on this front. In the latest NVRTX branches (4.25.4 and 4.26.0) we have some solutions for ray traced foliage in large scale scenes. This can be seen here:

Let me know if you have questions!

2020-12-20 18_50_11-Window.jpgHi, it seems like commands are not in the 4.26 build (except the first one). My foliage is kinda broken. And I found more forum posts here post mentioning problems with foliage in 4.26. What is the actual status of the foliage in 4.26 + RTX?

New improvements are great, especially the bias command.

It seems like foliage generated by the landscape grass tool isn’t managed properly, it doesn’t seem to be culled at all using any of the r.RayTracing.Geometry.InstancedStaticMeshes.Cull* commands. And disabling ‘Visible In Ray Tracing’ in the material section of the mesh disables the ray tracing effects but its still added to the BVH and ruins performance, same goes for ‘Cast Dynamic Shadow’ in the landscape grass panel. There is no option in the landscape grass panel to exclude it from raytracing in any way.

The commands are only in the NVRTX branches, there are some instructions here how to access them

So the normal released version doesn´t contain those commands and improvements? Will they then be integrated at some point into the normal version, so that everyone can use them? Otherwise what would be the point creating this stuff, if most cannot use it?

Good catches on these things. First off the cull commands work in editor but not in a compiled exe. This is a known issue, and I think we’ll have a fix out for it pretty soon. Give us just a bit of time because of the holiday break, but you won’t have to wait too long.

There’s a flag now to set the visible in ray tracing setting in the foliage tool/instanced mesh settings. I’m not sure about landscape material system though, if that’s what you mean. We probably need to look at that one more closely.

Thanks for pointing these things out though, we need to get every issue buttoned up.

I can’t give a timeframe or promise on that, but I can say what we do at NVIDIA is to make improvements to ray tracing and then work with Epic to try and get our work mainlined. Some things take longer for technical reasons so if you want the latest and greatest RTX right now we have the NVRTX branch. But we do want to mainline our code efforts as much as possible so that’s always a goal.

Honestly, I and everyone else would much rather be able to actually purchase a 3080 or 3090 to work rather than download a custom version of the engine :stuck_out_tongue:

As far as what you guys at nvidia could improve for the UE4 rendering there’s bushels of stuff.

Picking off an easy one. Ray tracing sub surface scattering on Foliage, Skin, Cloth, etc.
While I’m sure epic has someone looking into it after the 20th bug report, I would actually use the custom engine if that feature alone were avaliable and fully working (since its been over 6 months from the first report of the issue)…

Understood! I wish those sales problems with the latest cards didn’t happen, I hope it’s getting resolved.

FWIW, this latest version of NVRTX does have improved SSS for foliage, it should be equivalent to the raster material result. As for the rest of it I think we probably need to dig deeper on what’s going on there.

I really appreciate that, because personally, i am absolutely no fan of different branches and extra versions, just to get some things work. I prefer, if the main version, that one, which every basic customer gets, works as expected, without the requirement of workarounds or custom solutions.

That sounds great, since even in 4.26 subsurface scattering effects f.e. will not get reflected in any surface. And for two sided foliage, not sure, if your version is repaired, but the normal version has a pretty broken two-sided function, where the backside of a plane delivers really wrong stuff. And this affects every two sided material.

Or i am just to stupid to use it. But since i am mainly interested in transparent materials like glass, ice, crystals, water and even more in clouds and nebula (as in those fancy space nebulas), this is a real bummer, since all of those require properly working transparent materials, which in the best case also gets raytrace reflected in other objects, like space ship windows and hulls, or airplanes.

Aaand, merry Christmas :slight_smile:

me,too,personal email have no right to get the NvRTX file to install in to UE4.26,so we can’t get the useful raytracing cmd




When ray tracing is turned on in ue4.26, the dynamic effect of wind of foliage will greatly affect the UE performance,and the foliage has double mesh and the shadow is wried:
In UE landscep scene, when there are a lot of wind blowing grass, if you turn on ray tracing, the performance will be greatly reduced. I’ve tried many ways to turn off the ray tracing effect, but it’s still useless. I have to use Ue4.26’s gpulightmass bakes the light, so the Ray tracing must be turned on in the project. There is no way to turn it off, so you have to manually enter the command in CMD,like **[FONT=等线]r.raytracing.ForceAllRayTracingEffects 0.Or turn of **Vegetation’s wind dynamic effect.If someone know the resolution ,please tell us.thanks.

IF Its Ray Traced. You are moving geometry and asking it to render a shadow in real time.
of course its intensive performance wise. You would need to fine tune the level at which the shadow is traced, vs cascade, vs DFAO

first try to Disable the shadow completely and use DFAO.
Tough not with the models you are showing. A single blade of grass would need a DF resolution bump of 4 or more to render the static shadow somewhat decently.
either way, check performance. If you get an increase then all good. If not, bottom footnote.

Assuming you see a change, You can also try the nvidia rtx release of the engine. Its a little more performant, but you miss out on any hot fix to the engine until someone at nvidia updates the branch.
plus you have to compile it. Which takes time.

Additionally, the shadows you see could just be cascade (since Ray trace option is off).
Disable cascade distance or resolution to check before you blame Ray trace for the cost. Ot could just be normal feeding on the cascade settings.

If the mesh is doubled by a setting (i would wager it isnt). Do a stat RHI and get both tris count.
If you are correct, a count is more than another.
If my hunch is right, then maybe you painted more than one foliage in the exact same spot/size/rotation and one of them goes off time because of the fps drop, allowing you to see it.

Generally speaking if you use Ray trace you go for fully dynamic, so you should not be baking. A hybrid can be made to work well, but it needs major fine tuning.
Refer to this as a guide. Lots of stuff to toggle and setup.

Footnote:
Depending on hardware, just enabling raytrace in project settings can drop performance to a halting 5fps grind in the default levels. If that’s the case for you, you just need better hardware.

None of these commands seems to be in 4.26 or at least not all.

Do i need a special nvidia driver? i dont get the GitHub files are these a plugin?

i ran all these not effect on foliage !!!

r.RayTracing.Geometry.InstancedStaticMeshes.EvaluatWPO 1
r.raytracing.geometry.instanced.simulationCount 4
r.RayTracing.Geometry.UseBiasForSkipWPOEval
r.raytracing.Shadow.MaxBiasForInexactGeometry

Sorry I didn’t respond sooner. Latest driver is what you want. These features are in our NVRTX branch, so you would need to get that code, build it and run that branch. I’m guessing you’re trying these commands on 4.26 mainline and that’s why it didn’t work.

Hi @REC ,

Do you work hand to hand with Epic to make this kind of improvements integrated into UE mainline?

Thank you and best regards!

I’m also looking for these commands, but it is 5 months later and I couldn’t find any NVRTX repo on github, and all of the links to it is broken. Is there any reason for that? Or it’s just impossible to get a copy of the branch now?

Works for me. This is the repo: https://github.com/NvRTX/UnrealEngine

You need to be logged in and have connected your Github to your Epic account

1 Like

Oh so that is required, no wonder I couldn’t access it. Thank you