Swapping terrain lightmaps does not affect grass?

Hi all,

For our project we have a section where the sky will darken to create a moody atmosphere towards the end of our level. I've got the skybox fading between two textures and i'm controlling the intensity of our directional light, the sun. However we still had the problem of the terrain being unaffected.

Digging around i've discovered how to duplicate the terrain's lightmap and i've recalculated a darker version with the sunlight intensity lower. At the moment i've got a simple script which swaps between the two lightmaps when you press a key, but the grass decoration remains at it's current illumination. It does change to match each individual lightmap when I use them individually, but not when swapping between them.

One of the comments in this post suggests that grass and detail objects should be affected by the terrain lightmap, and even that in a realtime scenario multiple lightmaps could be used, but it's not working for me. Is it a Unity Pro only feature? We only have access to Indie at the moment.

I've also read in the docs about the 'Lightmap Factor' setting in the texture dialogue for the grass to control how much it is affected by the lightmap - what should this be set to? It's currently set at 1 but I don't know what the range is. 100 bleaches the grass to yellow.

I've heard that using multiple lightmaps in this scenario is not very efficient (although it will only be a brief transition, not a full day/night cycle) and I still have this script for blending lightmaps to try. But i'm getting the impression that it's not possible to have grass details affected by the terrain lightmap? I've read about exporting the terrain to a modelling package to lightmap the trees etc (that will be my next little adventure), but I don't see a solution with the grass.

It may be that I'll have to settle for tweaking the grass tint and/or ambient light levels to make the change less noticeable although the contrast is meant to be quite stark. I'll have to have another go when I get home later today.

If anyone has any ideas in the meantime, I would be very, very grateful.

Light maps should affect terrain details (grass, etc). However, once these details are generated, they are cached, so changing the light map will not immediately updated the detail shading.

Try calling the undocumented Terrain.Flush() method after changing the light map, to force it to regenerate the details.