VR Project with Ray Tracing or Lumen

Hello,

I’ve been developing a desktop VR project in Unreal Engine 5. Now, I have to enable ray tracing or/and Lumen. I know that it’s recommended to use the forward shading instead of the deferred one for VR, but ray tracing and Lumen require the second method. With the deferred shading, I catch many crashes. That is why I decided to ask a question because I’m have no idea how to continue with that. Is it even possible to develop such a project in Unreal Engine 5? Thank you in advance!

Best regards,
Alexander Temnyakov

Hi,
In case you haven’t seen this youtube link, it is worth a watch.
I also have tried Lumen+Nanite in VR. Its working somewhat fine for small projects with Lumen GI settings on mid to low, from post-process volume. But for big levels with a medium amount of details I got bad framerate, less then 20fps, and occasionally crashes. And this was happening on a RTX 3090.

I’ve been able to get a stable 60fps out of Lumen+Nanite in VR on an RTX3080 (software rendering… Raytracing looks fantastic but at too much of a cost). But you really need to optimize the darn tootin’ heck out of it.

Keep those draw calls waaaay down by collapsing things down to single meshes and using instanced meshes wherever you can, don’t use multiple materials in a mesh, be creative with a small number of flexible master materials that can be instanced to make what you need.

And keep things down to one active light whenever you can (which sucks, but that’s where we are right now). You can add logic to deactivate lights when they aren’t visible; level streaming can help with this as well.

No post process effects.

I’m no expert, but those are a few boilerplate things to keep in mind. You just really need to throw every optimization trick you can find at it and accept that there will be design limitations for now.

3 Likes

If you’re using Nanite, how are draw calls a problem for you? I understand the materials optimization, but not direct geo draw calls being an issue except for things like translucency and such. I’m purely curious, have not dabbled in VR at all.

Is foveated rendering working well in UE5 at the moment?

I am also wondering, since you’re already paying for lumen, could you replace a lot of punctual light sources with emissives? Obviously lighting would be less stable, but the devs talked about lumen (and this is true of my experience) basically solving emissive lighting for free in most circumstances.

That sounds extremely disappointing!

I really thought Nanite would eliminate mesh limitations (we import thousands of objects via Datasmith), similarly, I thought Lumen would also eliminate some limitations on lights, even though it may have a higher floor.

On the PC I’m currently working on using a 3090, I get 7fps when I convert an old forward shaded VR project to deferred with hardware raytracing.

Nanite does eliminate mesh limitations for the gbuffer, but as Ray-tracing requires persistant world-space data, it can’t really do anything (currently). You need similar optimization tricks for HWRT that you do for pre-nanite rasterization, as it’s the same fundumental problem of reducing draw calls and geometric complexity wherever you can.

Also, your RT settings will matter massively. Because of many rays lumen has to send out for large screen resolution, tiny differences in CVars can have massive perf. implications.

Has Epic (or anyone else) made a tutorial explaining what these CVars are?

You need to heavily optimize unreal for vr, even if it isn’t for the xr2+
Keep in mind, the engine is rendering 360, you you are rendering 8 times the screen space as a flat game.
If you use Lumen and nanite your end user will need to have rtx to play it.
If you use baked lights and optimized meshes, you can optimize down to a gtx 1060 and achieve decent performance.