Fake Fog Volume Tutorial

Hey there,

After several days of trying to figure out how to put Exponential Height Fog on the ceiling, I came across something called ‘Fog Volumes’ which seemed to be exactly what I needed. Unfortunately they didn’t seem to exist for UE4 and there wasn’t a whole lot of alternatives for what I needed. I managed to come up with this solution and would like to share it with the community and hope that some may find it useful or informative.

Here’s what we’re going to create.

Pros:

Easy to make!
Lets you have fog basically anywhere in any shape (depending on your mesh).
Works great for fog in the distance, for ceilings, or low to the ground.

Cons:

There are no sides to the fake volume. If standing inside, it looks kind of strange on the sides of the ‘volume’. There’s probably a way to fix this.
May be resource intensive, but I didn’t see any real impact when testing with 300+ sheets. Results may vary.
Dipping the camera down into the fog doesn’t look so great if there’s a bunch of space between the sheet.

So if this sounds like something you’re interested in, we’re going to have to create three pieces that work together to make this work.

To begin, grab a plane mesh.
I reused one I made for an impostor card piece.
It’s just a plane from Blender. Might have had a Solidify modifier added to it, but it should be fine as just a plane if the Material is two sided.

Second thing we’ll need is the Material which we’ll later make Material Instances out of.
The main thing here is the DepthFade node and the parameters attached to it.

Next you’ll want to create a Blueprint.
Inside you’ll add the InstancedStaticMesh component.
Shout out to Tech Art Aid for his awesome tutorials, which is where I learned about instancing.
Long story short, this works by throwing a bunch of planes on top each other using the ForLoop node under the Construction Script.
The Make Transform node and math attached to it offsets them one after another.
If your plane mesh is standing up like mine was, you can make the “Make Transform” node rotate it by 90 degrees here. User discretion.

Once you’ve got all that put together, throw the Blueprint down somewhere and if you created a Material Instance you can play with the parameters in there in addition to the ones with the Blueprint for varying effects.

If you use this, let me know or post a screenshot. I’d love to see how this gets used. If you have any questions, let me know and I’ll try to answer them as best I can. Also if there’s a better way of doing something like this, I’d love to your suggestions!

Happy hunting.

2 Likes

I havent tried it yet, but sweet idea man! Definitely going to give this a shot when I have time! :slight_smile:

Thanks a lot and cheers!

Just wanted to say thanks so much for this awesome solution to our Fog needs! Helped me a ton!
Also I’m using it to make some poison fog in a maze type level, sort of inspired by Mario 64’s “Hazy Maze Cave”!

Also just figured I’d add a bit more guiding information to this tutorial for those who are new to unreal. As I can see newcomers being confused at some parts, wouldn’t want them to feel left out!

- Creating Fog Material Tips -

The Color for the fog is a “VectorParameter”

The “DepthFadeOpacity” etc… params are just a bunch of “scalarParameter” renamed and given a default value of your choice.

“1-x” is simply the “oneMinus” math function.

As well to create an instanced material right click on your material in the content browser and create an instanced material out of it.

- FakeFog Blueprint Tips -

numberOfSheets and spawnDistance are just ints set to whatever value you choose to use.

spawn distance plugs into an “integer * integer” node then into a convert “toFloat(int)” node.

To create an instanced static mesh simply right click “Add Component” and add an “Instanced Static Mesh”.

Also don’t forget to add the plane static mesh and fog material instance to your instancedStaticMesh once it’s created (under the details tab of the component).
You’ll also want to change collision preset to “NoCollision” in the details tab as well. Unless you want to be able to collide with the fog!

Hope this helps if somebody is at all lost!

thx to you both for this interesting concept, may give it a try lateron …

That sounds amazing, I’d love to see.

Also glad the tutorial was able to help you out. Thanks for elaborating on it as well, and I apologize to anyone who might have got caught up.

If I could make a suggestion: I would change SpawnDistance to a float so that you’re not limited in distance between the sheets. With the more sheets you add to your volume, the distance that an integer based value gives starts to become too great and looks off. That being said, I built an art tool using this as a base for a project I got hired on, and when I can, I’ll post the whole thing here so that you guys can use it.

That sounds amazing!

It’s a great solution! Nice work! Any idea if this would be to heavy for a mobile game?

Sorry for the necro post but I can’t seem to get this to work properly.

As you can see, I have my stack of planes with the material, and it properly does DepthFade stuff when my opaque character model is standing inside of it, but it seems the sheets aren’t causing any DepthFade effect on each other. It seems the node only works when there are objects with opaque materials nearby, so the sheets, which are translucent, are being ignored.

its a gorgeous solution. it works just right (specially not shinning in the dark/close areas). thank you so much. i just attach a very big fogy sphere to the character and it feels like being inside a thick fog volume.

Very interesting and useful, only thing is, it’s quite demanding.
I tested on my setup and my frames could take to a 20 fps hit and in the shader debug (press F5 during gameplay) I could see it is very intensive.

I got a very similar result but way less demanding by just tweaking some values and using a single block/sheet instead of multiples sheets. The only real problem is that you cannot use this if you want your camera to be in the fog as it will break the illusion.

Also you wont need a blueprint actor for this, since its just a material. You can use any mesh and it should work

So all I did is :

  • Uncheck the Two Sided Material
  • Set the Opacity around 0.95
  • Set the Depth Fade to around 500 (You will have to play a lot with this one to get the right look you are looking for)

and that’s pretty much it. I personally used a block, because using a plane, it can break the illusion if the player is able to see the side or “start” of the fog.

Its possible cube make full fog? now when i move camera inside cube fog is only on faces cube