Fog and Mist

Hi guys.

I’ve been struggling to find anything useful to read on how to make a misty graveyard or spooky foggy forest.

I can use soft particles (that blend in to the depth map) which looks nice when you’re in it and from a reasonable distance. The problem with that approach is it looks very obvious there are blobs of fog from a distance.

I could fade them out but then you’d see the forest or graveyard with no fog until you got close which would looks strange too.

I think I need volumetric fog maybe? Unreal Engine talks about volumetric fog clouds.

Could anyone point me at something I could read on a technique like this? Ideally some example code or pseudo code even rather than a math heavy page?

Or give me an idea about some other approach?

Thanks.

Are you using forward or deferred lighting?

Deferred

I have a fog post process sample on my repo, but at the moment my code base does not like the latest MB build.

Neither does mine :smile:

I don’t mind looking at non-working code. That should maybe point me in the right direction

Ok, well my repo is here: https://github.com/NemoKradXNA/Randomchaos-MonoGame-Samples

Look under post processing :slight_smile:

thanks!

1 Like

Ok the post processing samples all work great in my version of MG :slight_smile:

So that gives me a nice blanket post-process fog. Now I’m thinking could I use a kind of “fog map” to make it so some areas are more foggy than others (rather than anything amazingly real-world). Like the spooky forest or graveyard etc. Maybe sample from a fog-noise texture as well to give it more of a random cloudiness.

Do you think that makes sense? Or am I barking up the wrong tree here?

1 Like

Yea, i had a bash at that in XNA. I’ll see if i can find a link to my old post and YouTube clip.

Not sure it worked that well, I think this was using a forward render, it was before I discovered deferred lighting lol.

I think what I did was effectively scroll a noise 2D texture over the scene and used that to render fog. A better way would be to use a 3D noise texture I guess.

Oh yes scrolling the noise texture is a nice idea. I’ll see what I come up with when I’ve finished the current area of the game I’m working on. So easy to get distracted with effects for days/weeks :rofl:

Thanks for your help :slight_smile:

1 Like