Download

Static shadows on foliage...

I’ve been working with UE4 now for a few weeks porting over my UDK project. Going pretty good so far but I have a big problem with foliage lighting. I use foliage to paint in bunches of small rocks into the scene. It seems more efficient for draw calls this way since in some cases it can be a lot of little rocks in a small area. So in the UDK it worked fine, lit fine, all was well. But in UE4, they don’t seem to receive or cast any static shadows. Not with a stationary light or even with a static light.

So in the shot here I am using a stationary light, not a static light, and the shadows there are all static shadows from normal static meshes accept the character of course. The rocks are painted in as foliage. I’m not using any cascaded shadows on purpose here to illustrate the point. You can see of course no static shadows either being cast, or received although they receive the dynamic shadow from the character just fine.

I’m wondering if I’m missing something really obvious or if they just can’t do it.

Not really looking for workarounds, I know there are and what they are. Just maybe a straight answer like… yes, this is what you do to make it work, or no, static shadows don’t work on foliage period.

Foliage_Static_Shadows.jpg

So I realized when I looked at wire frame, they are actually pink, which I guess would mean they are handled as interpActors would. In this case with a normal interpActor, I would force light maps, but for foliage there is no such setting. So I don’t know if they are even light mapped at all, let alone cast static shadows or not.

I remember reading in the docs that Foliage elements are not lightmapped but are lit dynamically and using Light probes… also AO post process makes them look better with more depth…

Instanced meshes, which foliage is, does not support lightmaps at the moment. They are dynamically lit only (as the purple color also hints at as you noted)

I really hope Epic will support lightmaps on instanced meshes at some point in the future, like UE3.

Thanks for the replies…

As for the help docs, this is what I found…

Lighting

Each individual mesh instance has its own shadow and/or light map generated by Lightmass, and these are tiled together for each precomputed batch. There are several settings on the Static Mesh that should be checked for precomputed lighting to operate well with instanced foliage. Lightmass is less forgiving when generating shadow maps for instanced meshes, and incorrect settings could lead to black meshes after rebuilding lighting.

Light Map Coordinate Index - This must be set to a valid UV channel that has a unique UV unwrapping. The Static Mesh Editor’s Generate Unique UVs feature, which you can access from the Window menu, can quickly generate a unique unwrapping.
Lightmap Resolution - This must be a small enough number so that all the shadow map for instances in a single cluster (by default 100) can be tiled together without exceeding the maximum texture resolution (4094x4096).

The documentation of foliage is currently incorrect, but since I expected it to be correct I kind of refused to stop looking for a solution. Seems there is no solution. I hope light mapping support is added also in the future.

Hourences, thanks, that does make sense, and to get confirmation on that as well. I also found this…

https://answers.unrealengine.com/questions/33870/meshes-placed-with-foliage-tool-do-not-receive-env.html

Which indicates that there’s just generally problems with foliage at the moment.

Hourences is correct, foliage does not support lightmaps atm. it’s on our list, but it’s a big list =)

Where did you find that doc info on foliage static lighting? I don’t see that in the UE4 docs anywhere, was it brought from UE3? UE3 docs don’t apply to UE4.

It’s right here at the very bottom of the page: