I just recently started with UE4, so I apologize if my question is something of common knowledge.
Every single time I start painting foliage on landscape I’m getting these errors when building lightmaps:
Warning InstancedFoliageActor_0 The total lightmap size for this InstancedStaticMeshComponent is large, consider reducing the component’s lightmap resolution or number of mesh instances in this component
As there is no custom settings or anything such involved, I expected to find lot’s of information about this warning. To my surprise I found none. So perhaps I’m doing something wrong from the very beginning, although I can’t think what it might be?
So, basically the warning says I need to do one of the two choices: A) reduce number of painted actors, or B) reduce mesh lightmap resolution.
But I don’t want to do either, because the result start to look crappy.
Is this some kind of limitation with UE4 or is there something I can do, other than make my level look like from 2004 era? I have seen quite stunning maps been done with UE4. They must have some kind of mechanism to circumvent this warning?
Another option, I guess, is just to ignore the warning. But I wonder if I will be running into performance problems then.
Thanks for reading
Hi Polka Tuba,
Take a look at the documentation here, specifically the Lighting section: Foliage Mode in Unreal Engine | Unreal Engine 5.1 Documentation
You will see that it details a little bit of information about the Lightmap Resolution for Foliage and how it is grouped.
Each instance that is painted in the Foliage Tool is not getting it’s own lightmap.
In the Foliage tool, go to Show Instance Settings > Lighting > Cast Static Shadows > Enable Lightmap Resolution and leave at a default of 8. Possibly raise it to 16 if you don’t like the results.
I wouldn’t go much higher than that, but do keep it at a power of two for the resolution.
As you mention, you could always ignore the warning, but it is just that. It’s a warning that there could be issues. Larger Lightmap resolutions mean larger texture size that is loaded which can lead to a bottleneck in streaming those in thus leading to performance issues.
Lowering the resolution would also help in your build times as well.
Thanks Tim for your reply,
Setting instance lightmap resolution to 32 gives acceptable results, but then the warning start to appear when building lightmaps. Perhpas 16 would be passable if nothing else helps…
I wonder if I should rather insert the objects manually into landscape and not using the paint tool? If I understood correctly, then they should get their own lightmap? Would this lead to a similar performance problem?
If using lots of foliage the foliage tool is the best route to go as these get batched together.
Typically with larger worlds that are open or using lots of foliage you would want to use Dynamic lighting since there would be moving trees and such. You can get away with Stationary for baked lighting at distances, but if you world is large you would incur some possible performance issues with lightmap textures needing to be loaded in as well. This is why lower lightmap resolutions are better. If you’re using Stationary light, you shouldn’t worry nearly as much about quality because it’ll be at such a distance that the player will never see it up close. Also, if you’ve got the Stationary light, make sure you’ve set the Dynamic Shadow Distance (Directional Light Source > Cascaded Shadow Maps > ). By default, it’s set to 0.
If you start running into any performance issues, using profiling tools is a good way to help narrow down where you’re having issues: Testing and Optimizing Your Content | Unreal Engine 5.1 Documentation
I have tried to follow these steps, but with the 4.8 version the settings in the Foliage tool are no longer available.
I’d like to place quite a lot of trees and grass in my landscape, without much lag if possible. How can I do that without said trees and grass having the lightmap error (and looking all dark and weirdly shaded)?
Ideally when using a lot of static meshes, like the ones you’ve painted with the foliage tool, it wouldn’t be ideal to use static lighting. You currently have ~42k assets painted with the foliage tool. To build lighting for this amount of assets would take a long time, use a large amount of RAM in the process, and storing the lightmap textures for these assets would likely give more issue than using only dynamic lighting.
Since you do mention that you’re using a day/night system you shouldn’t have the need to build lighting for anything in your scene since the movable light will negate the use of any static lighting. If you intend for your project to not use static lighting at all I would suggest going into the Project Setting > Rendering category and then disable the option for “Allow Static Lighting”, however, if you intend to use static lighting in some additional levels, but just not this one, then you can go to the World Settings and enable “Force No Precomputed Lighting”. This option will disable static lighting for this specific level and not for the entire project.
Generally speaking though, larger open worlds with a lot of dense foliage are not ideal for static lighting. Typically you wouldn’t want to use static lighting on objects that would need to move anyhow, like with trees or grass swaying to wind. The statically baked shadow will not move and break any sense of realism you may want for your scene.
I hope this helps.
Hey, all, I know this is an older thread but I wanted to say thanks to those who posted here. This thread was really helpful to me while learning how to build scenes and levels in UE4.
Hey guys, I’d really like to get some high quality foliage (particularly grass) and render times aren’t much of an issue for me. Dynamic lighting doesn’t look good on foliage, particularly when it’s outside of direct sunlight, I don’t seem to get any shadow between grass blades, for example. Is there any way I can get around this limitation to foliage lightmap size?
I recently had the same issue which I just resolved. For this error you must go and change each individual foliage mesh settings. Change the setting to following.
Min Lightmap Resolution > 8
Source lightmap index > 1
Light map resolution > 8
These settings resolved my problem after two days of research. Yet again I’m just a beginner in ue4. My answer may not be 100% accurate for every type of foliage.
same issue from 2021. And cool fix. Thank you sir
Alternatively volumetric lightmap