Fog EXCEPT around the player, HDRP

Hey guys!

What would be the best way to have fog everywhere except in a circle around the player? My intention is to have it work kind of like a “fog of war”, hindering visibility the farther you get from from the player. There is a “maximum fog distance” parameter, but no “minimum fog distance” parameter.

Thanks!

1 Like

One easy approach would be to place a local volume on the player, which overrides the volumetric fog, to either reduce or turn off the fog entirely. Just make sure it has a higher priority than the global volume that contains the heavy fog.

1 Like

Thanks for the reply! Unfortunately this didn’t work. Should this volume be global or local? When I set it to global it completely turns off all of the global fog. When I set it to local the fogs seem to add up instead of one canceling the other. I tried a bunch of different settings but no matter what I can’t have absolutely no fog around the player and solid fog starting outside a specific radius around the player. I made sure to set a higher priority and add a corresponding sphere collider.

Maybe you can show the two volumes, and their profiles, that you’re using? This mostly works fine for me, under HDRP 7.5.1.

Start with a global volume with extremely strong fog:

Now, set up the local volume, which needs a collider to determine its bounds, and override the fog to be significantly less. Make sure the Priority is higher than the global volume:

And very importantly, make sure that you place this object such that the camera goes inside the collider’s bounds, since that’s the only volume in which this effect takes place.

With this setup, moving the camera into or out of the bounding sphere shows a noticeable change in fog intensity. I will say that the blending between the two isn’t very good, even with a high Blend Distance, but maybe that’s okay with your.

1 Like

I copied the parameters exactly, but the effect I’m getting is not the one I wanted. I made a crude example in Photoshop to illustrate what I was after:

And this is what I’m getting:

Parameters:

It seems the override can only add more fog, not remove it completely. Would it perhaps be possible to do something like I did in Photoshop? Have strong fog everywhere then somehow just mask off the part I don’t want fog in?

So, you’re using a camera that automatically moves with the player? I guess from your earlier statement, I got the impression that you were creating more of a MOBA style game, where the player’s movement is independent from the camera, so that moving the camera too far from the player resulted in a fog of war in a radius around the player:

But your screenshot makes it look like you’ve got a standard 3rd-person camera, which moves as the player moves.

In any case, it sounds like you want an inner sphere/circle of no fog, and then to have fog begin at some distance from the player. I’m not aware of a way to achieve that without having at least some noticeable fog in the area around the player. Perhaps you can achieve this with a post-processing effect that desaturates based on distance from the camera? Or maybe someone else has a better idea.

1 Like

That’s a pity! Thank you very much for your help. This seems like it should be pretty easy to do, I’m surprised there isn’t a “minimum distance” parameter, which would be perfect.

In case anyone is interested, someone in Discord suggested this: Cloud Shader Breakdown – Cyan which seems promising!

My wild guess would be that it’s not physically accurate. HDRP has tried really hard to make things work the way they do in “real life”. Although in a game it’s fine to say “fog shouldn’t start for 10 meters around me”, that’s not how the real world works. But who knows.

2 Likes