Static, stationary, moveable sunsky

Few months ago I switched from “classic” rendering system to realtime - UE for my architecture visualisation. Clients (and I) love it, especially when you come with game on your laptop and you can explain a lot more than with just few photos.
However, there is one problem that I couldnt find any set answer to just yet. I have no problems with interiors, just put most (or all) lighting to static and bake them, no problem, everything works and looks great. Its the exterior that is the problem. I have some problems with greenery or lighting/shading it. For example trees, bushes, grass. If I put those as static it absolutely kills baking times + quite alot of my tree/foilage collection simply gets baked black, or just completely off (I suspect there are too many of them), in those cases sunsky is also put to static. Lately I have picked a habit to put foilage and trees to moveable, which normalises bake times, but those objects look totally unrealistically lighted and they have no shadows (mind you, still better than looking black after bake). So I was wondering, putting sunsky on moveable would just mean everything is shaded dynamically (including static architecture elements - walls, slabs,… and greenery ofcourse). I am looking for a way to light moveable objects (greenery) dynamically, which means they get properly lighted with shadows, and keep static objects baked. Would putting sunsky to stationary solve that?

Thanks for answers

If the directional and skylight in the SunSky are set to stationary, then the direct lighting is going to explicitly be dynamic. The indirect lighting (according to number of bounces in World Lightmass, and other settings) is going to be baked, which should maintain a faster bake, but introduce a mixture of dynamic and baked aspects of lighting / shadows. So, the problems or challenges are going to be getting the lighting and shadows to be set right in every type of foliage, and not losing quality or detail in other things such as the structures and indoor scenes. I think it is far better to use dynamic lighting completely, if possible for the scene’s intended results, than to grapple with stationary lighting. Changing to stationary most likely is going to involve changing the materials and setup of foliage actors, and probably using post process volumes or trigger volumes around and inside structures to maintain proper lighting for those. Dynamic lighting lights and shadows static and dynamic objects, whereas stationary can screw with it all based on the mobility set for different things, and the materials / settings of those different things. Is the scene currently using Cascaded Shadow Maps? Distance Field Shadows? Ray Tracing?

This is how I set my outdoor lighting:

  • Stationary sun with Dynamic Shadow Distance set to between 500 and 2000. This will give you dynamic high quality shadows for close up vegetation and baked shadows for further away objects.
  • Static skylight with low intensity. This is just to avoid completely black shadows. This will flood the scene with a subtle lighting while the directional lighting does the main job. I use a basic HDRI in the skylight instead of the generated cubemap and rotate this image to match the sun angle.
  • I use one of the Epic provided LUTs for basic colour grading in the post process volume. Search for it in the engine content.
  • I use the foliage tool for most, if not all of my vegetation. Because I have close up dynamic shadows I can go and reduce the lightmap size for trees quite significantly. Depends on how many I have I go down to 64 or even 32. These settings will overwrite any lightmap settings of the mesh. You could still place a few trees manually close to the walkable area with higher lightmap resolution while the bulk of the vegetation has low resolution and saves build time.
  • Grass, low growing bushes, flowers don’t really need to have shadows in the distance at all so you can try to set them to dynamic or disable static shadows depending on your performance or if they impact lighting build time too much. I usually leave them static unless I have a very big area with 3d grass.

Using static lighting requires a lightmap. You can create lightmaps for black objects that do not have a lightmap or the lightmap is not usable. Double click the mesh to open the static mesh browser. In the build settings is a tick box to create the lightmap and a source and target uv index… Set the desired lightmap size and hit apply to create the lightmap. Then go down to the general settings and set the lightmap size and the lightmap id to the same settings as they are in the build section. Hope that makes sense.

If you decide to use dynamic lighting and a stationary light you need to set the dynamic shadow distance to something other than 0.0 or your vegetation will have no shadow at all.
If you use dynamic lighting you can enable Distance Field Shadows in the project properties and then tweak them in the directional sun light actor. They create a blob like shadow which actually doesn’t look too bad in the distance.

the trick with dynamic lighting is to extend the dynamic shadow distance far enough to look good without causing too much of a performance hit. Then use the distance field shadows for the objects further away. You should also turn off precomputed lighting in the project settings when going fully dynamic. I haven’t used fully dynamic lighting for a while but it shouldn’t have changed that much.