Dynamic Light + Foliage Tool

Hi all,

I hve an ongoing issue where movable meshes placed by the foliage tool are rendering as extremely dark when shadowed by static meshes. I have been battling this for the better part of a year, so I’m quite ready to have it figured out!

The scene is made up of the following lighting-wise:

  • Stationary Directional Light with Cascaded Shadow Maps on
  • Stationary Skylight, casting all shadows

What happens, is that it seems the foliage tool or lightmass hits a critical “mass” (bad pun?) when placing foliage. They will appear fine in the viewport as I place them, then as soon as I place one too many, all previously placed objects start rendering very dark when shadowed. If I remove the last mesh, all previous meshes return to rendering as they should. What is more bizarre, is that the surrounding landscape uses the same meshes placed with the landscape grass tool, and they work beautifully. It seems quite random too - one day, it will be working ok-ish, then I try and refine it and start again and it gets much worse.

Other things to add

  • This affects stuff from the kite demo and my own Speedtree assets alike, so it doesn’t seem that my shaders are the issue
  • I have checked my own assets and they are set up correctly in terms of light-map coordinates and resolution
  • The static mesh which they are being placed upon is quite large and is shadowed by the landscape a lot - would this make a difference? The resolution for that mesh is high, at 4096, as I was getting awful baked shadows otherwise
  • It seems that where I place the foliage on the mesh makes a difference - if I get the problem when placing foliage lower down the mesh (on the Z axis), I often find I can still place some higher up without having the issue
  • The scene is pretty heavy - 60fps on a GTX1080, not sure if this makes a difference.
  • When the issue crops up, I’ve noticed that the AO of the affected meshes (via material instance) cannot be changed… this seems linked somehow
  • Sometimes the foliage shows up as bright blue… couldn’t find anything on that either
  • Light builds make no difference
  • My “location” in the scene in relation to the mesh I am placing the foliage on seems to make a difference, though what this relationship is exactly is hard to tell. Sometimes from further away I will have blue foliage showing up, and then if I zoom in a fair bit, the foliage will place nicely, but generally this is random, see last couple images (I couldn’t upload the final image to compare, take my word!)

I’ve turned off all AO on the main foliage in the images so they appear bright and obvious, and I’ve just plopped them on all the meshes, but they actually need to only go on the surrounding bits of bare site.

This is driving me bonkers, so any suggestion is appreciated. I’d be quite happy to be shown I’m a moron and missing something obvious!

Hey eliotbnz,

So it sounds like you are hitting the max combined lightmass size of your foliage instances per landscape component. When using the foliage tool you can only paint a set number of instances per component up until they no longer fit within the lightmap size limitation placed on each component.

This is why you get an override within the foliage tool itself to set the desired lightmap resolution on each foliage type. Take a look at the documentation we have provided on this procedure.

Foliage - Lighting

Let me know if you have further questions.

Thanks,