[Live Stream/Training Request] VR Lighting / Shadows

Hi,

I watch allot of the UE4 YouTube video’s and implement some of them in my UE4 project.

Unfortunately there is not allot of information on how to do Lighting /Shadows in VR.
Especially when using a big open world.

The video ‘Getting Started with World Composition | Live Training | Unreal Engine’ ( https://www.youtube.com/watch?v=FrcNClb6KUI )
was great.

Maybe you can use it as a starting point on what to do for lighting (and what not to do)

Things to address:

1: Don’t use dynamic shadow (or how to setup cascade shadow maps)

Solution 1: Disable them for everything in the level
Solution 2: Set shadow setting to none
New Problem -> everything no longer has a shadow
Solution: Use something called ‘Cascade Shadow Maps’, how to set this up? (when its enabled why doesn’t this work out of the box)
Note: Should static shadows/lighting still be enabled?

  1. Required settings: e.g Enable Instanced Stereo Rendering and other things that should be enabled in DefaultEngine.ini. For instance adding a [Oculus.Settings] when using an Oculus hs.

  2. Enable Forward Shading Renderer (& Multisample Anti-Aliasing)
    Note: This breaks materials, the solution is to edit all materials and change the texture to WrapShared.

  3. Don’t use a giant light mass volume importance, since then Build Lighting will crash in 4.19.
    Partial-Solution 1: Increase OS virtual memory.
    Partial-Solution 2: Break up into multiple instances, what would be a recommended size?
    Note: In a big world you might have a high mountain which ends in a beach / sea, with birds flying at mounter height over it.
    Now the shadow of each bird should be shown on the beach, so the shadow clipping level should be relatively big while still maintaining high FPS.

  4. Best way to setup the ‘sun’, E.g Skylight, Point light (Static / Movable / Stationary).
    Note: Some videos contradict each other on what to use for VR.

Note: Off course there is this video:

Lighting with Unreal Engine Masterclass | Unreal Dev Day Montreal 2017 | Unreal Engine ( https://www.youtube.com/watch?v=ihg4uirMcec )

It’s quite informative, but it doesn’t go into details on how to do this inside of the Editor.
Also the speaker is a bit hard to understand sometimes.

Hi TQwan,

Thanks for the suggestion! I’ve added it to the list of potential ones that we can pull from for a live training stream in the future. in the meantime, I can probably point out some things that you bring up.

  • Have you checked out Robo Recall? It’s freely available to download and you can take a look at how we set up the lighting for the levels. Dynamic lighting is used along with Static lighting. However, there are a lot of indirectly lit areas where we use Capsule Shadows for characters.

    • See the Cascaded Shadow Maps doc here: Content Examples Sample Project for Unreal Engine | Unreal Engine 5.1 Documentation

      • When you use a Stationary Directional Light, these dynamic shadow distance is set to 0, so you have to manually set that as needed. Use a short distance near the camera and rely on baked shadowing for farther objects than this distance.

    • For VR static lighting should still be used. Dynamic shadowing is expensive to use, especially with VR.

  • Take a look at this blog for a VR optimization and change that came with 4.19 that can help you with the HMD resolution changes: Significant Changes Coming To VR Resolution Settings in 4.19 - Unreal Engine

  • For lightmass importance volumes, it’s best to have multiple for your level that is only placed in playable areas. Anything outside of the lightmass importance volume will get a lower quality. So if the player cannot get to that area, there is no need to use one. If it’s open world, then a large one is OK. You mention that you get a crash, can I assume this is a “lightmass crash” and not an Editor crash? If it’s a lightmass crash, you are running out of memory when building lighting. Try reducing lightmap resolutions where you can and look into using Swarm Agent to offload some of the lighting build process to other machines. (We have docs coming for this soon! Until then, check out this site: Tutorial: Setting Up Swarm for Multiple Machines | Brian Goodsell - Environment Artwork)

    • “Now the shadow of each bird should be shown on the beach, so the shadow clipping level should be relatively big while still maintaining high FPS.”

    • This has nothing to do with lightmass and baked shadows. Since the birds are moving (or should be) you'd want dynamic shadowing. For VR this is expensive, so if it's a shadow that is far away, you won't really be able to do that (at least not in a performant way!).
  • “Best way to set up the ‘sun’, E.g Skylight, Point light (Static / Movable / Stationary).”

  • There isn't a really specific way to set these up for most projects since you the intensity and coloring of each is going to be dependent on the style that you're going for. Some optimization tips though, may help.
    • Point/Spot Lights

      • Use Static or Stationary lights whenever possible. For Stationary Lights, it’s best to keep their influence radius lower, whenever possible.

      • Set a Max Distance and Fade Distance. If the lights are movable or stationary, the dynamic light and shadows casting will cull (not render) past this distance, saving you some performance. We use this on Fortnite a lot!

      • You have a per-light setting for Shadow Resolution. You can lower this value to lower the resolution of the dynamic shadow map. Shadows that are dynamically cast may not look sharp but you save some performance here too.

    • Directional Light - Stationary

      • for VR, use a Stationary Directional light if you require dynamic shadowing. Use a low dynamic shadow distance to keep CSM shadows as close to the camera as needed so that baked shadows are used beyond this point.

    • Sky Light

      • probably best to use a Static sky light.

I hope this helps for the moment. Each project and your specific needs can’t always be distilled down into a single “use this and you’ll be golden” option. Often times, you have to make trade-offs for performance versus quality. For VR performance is more ideal, but that doesn’t mean that you can’t find creative ways to fake an effect or feature to still get the result. Just something to also be aware of and consider while you’re developing your project.

especially now with the oculus go and quest, this would be a very useful livestream!

Going to bump this because I think it’s important.
There’s hardly any content anywhere regarding this information. I believe this would be super beneficial for all indie developers.