Article written by Ryan B.
The current limit of grass outputs per material is 18. If you find that you need to increase this limit then you will need to modify the shader file, LandscapeGrassWeight.usf, where the limitation is hardcoded as it’s not possible through the editor.
LandscapeGrassWeight renders multiple grass layers in multiple passes in which each pass can do 4 layers (the only exception being the first pass). By following this existing logic inside the shader file, the number of supported grass layers can be easily expanded. For example, adding the following code after the 5th pass will expand the limit from 18 to 22:
#if NUM_MATERIAL_OUTPUTS_GETGRASSWEIGHT > 18 case 5: OutColor.x = GetGrassWeight18(MaterialParameters); #if NUM_MATERIAL_OUTPUTS_GETGRASSWEIGHT > 19 OutColor.y = GetGrassWeight19(MaterialParameters); #else OutColor.y = 0; #endif #if NUM_MATERIAL_OUTPUTS_GETGRASSWEIGHT > 20 OutColor.z = GetGrassWeight20(MaterialParameters); #else OutColor.z = 0; #endif #if NUM_MATERIAL_OUTPUTS_GETGRASSWEIGHT > 21 OutColor.w = GetGrassWeight21(MaterialParameters); #else OutColor.w = 0; #endif break; #endif // NUM_MATERIAL_OUTPUTS_GETGRASSWEIGHT > 18
It should be noted that this shader is only used in the editor to generate the grass weightmaps and that these weightmaps will only be generated for the landscape components that make use of the particular grass types. All landscape components in a single landscape actor should either use the same material or use materials with the same ordered list of grass outputs.