Monday, August 5, 2013

[UDK Quick Tip] Foliage Tool Lightmaps

Whenever using UDKs foliage tool with static lighting take into consideration that all lightmaps of a single foliage cluster are batched into a single lightmap texture.
This is the reason why you should always keep the amount of instances per cluster at a power of 2 value. The default cluster size is 100 which is a waste of 21.875% of lightmap memory compared to a size of 128. To take it one step further try to make the total amount of instances equal to the product of cluster count multiplied by instances per cluster, or at least slightly less. Also increase the cluster radius so that it does no affect the cluster count at all.

I did a quick comparison with a simple landscape and some foliage (~3200 grass meshes, ~320 trees).
The cluster size for the non-optimized run was 50/10 and 64/16 for the optimized one. The foliage lightmaps have been rather small (grass 16²px, trees 128²px).

Map size Lightmap Memory Shadowmap Memory Lightmap Count
non-optimized 163 MB 38.2 MB 32.3 MB 358
optimized 152 MB 29.5 MB 23.9 MB 329

Another reason for optimizing the lightmap usage for foliage is artifacts you might get with meshes which have multiple materials, e.g. trees (bark + leaves)

1 comment:

  1. DUDE!!!!!!!!! You are my hero. I have dug and dug and dug and searched the internet for a solution to to the light map problem visible on the trunk in the first picture. I have had plants with bad lightmaps ( black splotches on them ) popping up inexplicably while using the foliage tool. Setting the instances per cluster to 16 has fixed my problem. Such a simple solution, but I could not find it until this post. Thank you!