Foliage static lighting intermittently fails

I have a lingering (also in UE 4.9) problem with my (hand-placed) foliage static lighting occasionally failing, raising the ‘lighting need to be rebuilt’ map error and causing the foliage to be dynamically lit, which looks terrible and causes terrible performance. The problem then persists with every build, but (I think) occasionally fixing itself.

I don’t know what causes it and I don’t know what (occasionally) fixes it. Usually the problem arises after I’ve tweaked or imported a static mesh or two while incrementally improving/filling a level (possibly while fiddling with static lights) - nothing to do with foliage. Migrating to another project and/or upgrading the engine fixes it (for a while) but rebuilding the lighting with “Force No Precomputed Lighting” set and then unset does not fix it.

In the first picture, the problem is shown in the upper part; the lower part is the lighting when it is working (the grass looks a bit rubbish generally, but that’s another problem…).

The other pictures show my lighting settings on a typical foliage element (said grass), in my world settings and in the editor settings for rendering. I have a stationary directional sun light, and my remaining lights are all static. When I do a DumpUnbuiltLightInteractions, the five instanced foliage meshes appear, as does every single one of my static lights (including those which do not seemingly encroach on the foliage). The foliage lightmaps are all set to 8, with 1900 or so foliage elements placed in total, so the lightmaps are not crazy big.

As an aside, I have Hierarchical LOD turned off because turning that on causes a rendering error with one or two of the speedtrees that I’ve imported (that may have to be a separate query but perhaps is related).

Any suggestions welcome - for performance reasons I can’t switch to dynamic shadows (I tried, and I don’t think that fixed it either).

Thanks

PS all the foliage actors are standard Speedtree imports from standard Speedtree packages - to my recollection I’ve not touched a thing.

PPS this seems a similar issue but was not followed up https://answers.unrealengine.com/questions/290753/worldsettings-1-error-lighting-needs-to-be-rebuild-1.html

Hello Fatmarrow,

Have a look at this from our documentation. There are a few settings you can check on and look into for more accurate results when computing light for instance static mesh’s.

Let me know if a few of these troubleshoots help.

Thanks for the suggestions - the UVs are fine, as they’re stock Speedtree models and were previously rendering fine.

As for the lightmap resolution, possibly the failure of the hierarchical LOD system to work is causing lots of/all foliage meshes to be grouped into a single shadow map, but at an individual lightmap resolution of 8 I don’t think even all of the foliage meshes taken together would fill up a 4096x4096 shadow map (by my calculation you can fit in 512 x 512 of those 8x8 individual lightmaps, which is far larger than the number of foliage meshes [1900 or so] ).

Also I’m not sure how a sub-optimal foliage light map situation can cause all of the lights in the map (intermittently) to have unbuilt interactions.

PS also the foliage doesn’t turn black (as is usually the case with a duff lightmap) - it’s brighter and seems dynamically lit. In the first picture above, the top half is the foliage when the lighting has failed, not the bottom half.

On the other hand, when I run PIE it complains that there are 309 unbuilt objects, whereas there are 5 different types of foliage numbering around 1900 meshes, and all types of foliage seem to have the same problem (too bright/no static lighting) though that’s hard to verify at the moment.

DumpUnbuiltLightInteractions produces the following:

DumpUnbuiltLightIteractions
Lights with unbuilt interactions: 70
Light LightSource
Light fatGB-BP-exterior-floorlight_C_0
… (basically every static? light in-game)
Light fatGB-BP-exterior-floorlight13

Primitives with unbuilt interactions: 5
Primitive FoliageInstancedStaticMeshComponent /Game/StarterContent/Maps/UEDPIE_0_Minimal_Default.Minimal_Default:PersistentLevel.InstancedFoliageActor_0.FoliageInstancedStaticMeshComponent_0
Primitive FoliageInstancedStaticMeshComponent /Game/StarterContent/Maps/UEDPIE_0_Minimal_Default.Minimal_Default:PersistentLevel.InstancedFoliageActor_0.FoliageInstancedStaticMeshComponent_2
Primitive FoliageInstancedStaticMeshComponent /Game/StarterContent/Maps/UEDPIE_0_Minimal_Default.Minimal_Default:PersistentLevel.InstancedFoliageActor_0.FoliageInstancedStaticMeshComponent_8
Primitive FoliageInstancedStaticMeshComponent /Game/StarterContent/Maps/UEDPIE_0_Minimal_Default.Minimal_Default:PersistentLevel.InstancedFoliageActor_0.FoliageInstancedStaticMeshComponent_5
Primitive FoliageInstancedStaticMeshComponent /Game/StarterContent/Maps/UEDPIE_0_Minimal_Default.Minimal_Default:PersistentLevel.InstancedFoliageActor_0.FoliageInstancedStaticMeshComponent_1

Interesting. I’m not quite sure why you still need to build lighting only in PIE. However, to address your foliage becoming lighter and seemingly acting as though dynamically lit this is a known issue. What is happening is that when you use Instance static meshes, either through a Blueprint or using the foliage tool, the indirect lighting cache will not correctly light these meshes.

So if the foliage in the shade is taking the information from the light source, then it will illuminate the foliage as if it was not in the shade.

I do not have an ETA for when this will be fixed. I can add this thread to the reported bug in hopes that more users reporting the same issue will call for more support.

The report number is UE - 20029

The only work around for this is to use fully dynamic lighting. Before any of the following steps please save your project as you will need to restart it. Turn off allow static lighting in your project settings > rendering and there is a check box there for it. Also you can go to world settings and check “Force No Precomputed Lighting”.

Did my long reply just get killed? This is so frustrating

Maybe it’ll reappear. In brief, yes please please report this, and thank you for providing an explanation.

Key points (again):

  • the lighting does work at the beginning (making new project etc), so I know it’s possible
  • the bugged foliage does receive shadows. The issue is that it becomes dynamically lit, despite being marked static. Making the foliage and lighting moveable and rebuilding results in exact same appearance.
  • when the foliage is bugged the framerate drops from 60fps to below 10fps. Dynamic lighting is not an option.
  • I also have interiors where dynamic lighting would look bad and make the performance worse
  • if I can’t have foliage (via normal foliage tool) and static lighting in my map, this is a BIG issue
  • until this bug is fixed, I suggest you should warn people about this in the standard documentation on lighting types and lighting problems, at a minimum. It’s a showstopper for anyone working on a ‘real world’ map with a mix of foliage and interiors.

Thanks

Here is a snapshot from PIE (fewer unbuilt objects but still some because I only made the grass moveable and didn’t change the trees). Appearance as before, including shadowing from landscape (and also meshes I think).

http://i.imgur.com/vypuO3d.jpg

I just noticed that performance was far better than before, though with the same visual results (poor). Changing the sun actor to moveable makes things faster? I really have no idea what’s going on now with all this stuff.

I have added this thread to the list of issues regarding static lighting caches only being derived from one source along with adding the issue of static light calculations in larger foliage scenes.

The ticket number is UE-20029.

Again, I do not have an ETA for when this issue will be resolved or how quickly it will gain support.

Thank you very much for reporting this issue to us.