Possible to add emission to volumetric fog custom shaders?

Is it possible to add emission to volumetric fog custom shaders used on a Local Volumetric Fog component in HDRP? Their fragment only has Base Color and Alpha but we want to add some subtle illumination to the fog so its always visible, even when you are far outside of its bounds and there is no directional light.

Already answered in discord, the short answer is : no :slight_smile:

The fog rendering works by storing a camera space fog buffer containing the color and density(alpha), to have emission it would need and other buffer for the emission value.

And easy hack would be to add a point light within the fog volume to look like it is emitting light.

1 Like

I’d like to add that fog will also pick up indirect lighting data from a baked adaptive probe volume, so one hack would be, if you can’t afford realtime lights, you could bake the indirect lighting from those lights with APV and then your fog would be slightly illuminated by that and the result would be much more uniform and smooth than some point lights.

Thanks for the ideas. I wasn’t expecting support so quickly, so that’s really appreciated. Apologies for cross-posting on Discord, I’ll keep the conversation here in case anyone else can benefit in future.

And easy hack would be to add a point light within the fog volume to look like it is emitting light.

We are trying to light up all the fog above ground but not below it in a scene which is about 300x300. It’s a city and then there is a subway underground. I couldn’t get Point/Spot lights to achieve a uniform lit look to the fog across such an area. I tried a Directional light (with Affect diffuse+specular disabled) which looked great but that impacts everything underground too obviously (because shadows are off) so that was a no go.

I’d like to add that fog will also pick up indirect lighting data from a baked adaptive probe volume, so one hack would be, if you can’t afford realtime lights, you could bake the indirect lighting from those lights with APV and then your fog would be slightly illuminated by that and the result would be much more uniform and smooth than some point lights.

I played around with this idea too. Using a Directional Light set to Baked seemed to provide the best results but I struggled to get a APV to bake so that just the fog above ground would be lit and not the fog underground. I had to force something to be static for it to bake at all but then the memory footprint ended up quite large (we were trying to avoid all baking for this game, its low poly with no realtime shadows). Even then, the cells seemed to stretch underground no matter what size my APV was and where I placed the single static cube I had stretched across the scene. Fill empty spaces is disabled.

I feel like the best solution would be to use a realtime Area Light to light up the fog but that doesn’t seem to support volumetrics?

Hmm I think potentially a realtime spot light with a Box shape facing upwards from the ground and its size stretched across the entire scene works. With Affect Diffuse and Specular checked off.

1 Like