How would one modify Lightmap Exposure/Intensity at runtime for a day/night cycle?

I have baked lightmaps using the sxybox and am using mixed lighting so I can have realtime shadows on everything. This is so that I can have a moving sun (i.e directional light) for a day/night cycle. During the day this works fine, but at night the lightmap makes objects too bright, since it uses the daytime skybox. Now the Scene Editor window allows you to adjust the exposure of a lightmap in the Baked Lightmap view. I was wondering if there was a way to script in a reduction in the exposure or intensity of the lightmap at runtime so that the objects are less bright at night.

NOTE: Lightmap switching isn’t necessary, or useful, since I need a smooth reduction in brightness over time, as opposed to the sharp reduction that would happen if I changed to a totally different lightmap.

EDIT: I forgot to mention, I’m trying to do this with URP.

1 Like

HDRP: Indirect Lighting Controller | High Definition RP | 8.1.0

1 Like

Ah thanks for this, I’m sure someone will find it useful. Problem is, and this is my bad for not mentioning, I’m using URP, since the game is supposed to run on crappy devices. I’ll check it out anyway.

1 Like

Another variant for URP: change materials (ambient occlusion map coefficient):
occlusion map texture is white, coefficient = 1 , material is normal on light (white, receive all light), this is global day.
occlusion map texture is white, coefficient <1 , material is black on light (black, dont receive all light), this is global night.

Try change ambient occlusion map in all materials globaly.
I don’t know if this is possible.
You need special materials for level meshes.

Or you can change material in realtime for all level meshes, but it bad for performance.
And you can make own special shader in Shader Graph.

Ref:

It’s a shame that such functionality apparently doesnt exist. It could be useful for day/night cycle, if there would be a lightmap tint setting.

1 Like