So,
I’ve been looking into this issue for a the past few days now and have come to the conclusion that either foliage with baked static lighting is currently fundamentally broken due to what seems like some design oversights, or that I’m missing something with how it works altogether.
My scenario is this:
-
I have a large landscape with approximately 31k trees, currently consisting of 1 tree model.
-
The tree model has lightmap Uvs carefully laid out for a minimum of a 32 x 32 px lightmap, which the model is set to by default in the static mesh editor.
-
Tested and baked individually with the default lightmap size of 32px, the tree lights correctly as expected.
Upon painting and baking lighting for the tree on the landscape, I am receiving the following warning:
**
**
The result of this is that the lighting for the trees looks very bad, seemingly due to the lightmaps now being reduced below 32px. Looking at the warning, it tells me to “consider reducing the component’s lightmap resolution or number of mesh instances in this component”
Now, to me this is unexpected - my landscape is made up of 64 components, each with approximately 484 trees, my Packed Light and Shadow Map Texture Size is set to 1024 in World Settings, so it seems like there should be plenty of room for 484 32x32 lightmap atlases. (if my calculations are correct, you can fit 1024 32x32 lightmaps into a 1024x1024 texture).
Regardless, I gave it the benefit of the doubt and increased Packed Light and Shadow Map Texture Size to 2048, and then 4096. The result was always the same warning + bad lighting on my trees.
I did some further investigation, looking at the baked lightmaps themselves with Packed Light and Shadow Map Texture Size maxed out at 4096, and concluded that it currently tries to bake all foliage into the same atlas, regardless of any landscape component. With this and the fact that the editor references all foliage as InstancedFoliageActor_0, It seems that all foliage is treated by the lightmapper as one giant model which would be highly inefficient, especially when it comes to texture/lightmap streaming.
Here are the following things I have tried to break up the foliage into smaller components/lightmap atlases:
-
Duplicating the model and painting the copies as different foliage types.
-
Creating multiple Foliage Type assets with the same model and painting them as above.
-
Separating the landscape into 4 different sub-levels and re-baking (highly inefficient workflow)
None of the above worked for me, I still receive the same warnings and the same issues for all scenarios.
In Epics own documentation on Foliage Instance Meshes I found this under Lighting:
**
**
Has the cluster size been changed? Can it be changed manually? I cannot reduce the lightmap size of my trees any lower and it seems crazy that the engine would not atlas them per-component. I’ve seen dozens of threads posted about this issue with zero solutions and I think it really needs to be addressed.
Can someone offer insight or advice on this?
I’d be happy to upload an example project if necessary.
Thanks
Answerhub Post is here