A Guide to Volumetric Fog in UE4
Subscribe:  iCal  |  Google Calendar
Las Vegas US   8, Jan — 12, Jan
Zürich CH   31, Jan — 4, Feb
Leamington Spa GB   31, Jan — 3, Feb
Bradford GB   6, Feb — 11, Feb
Bradford GB   7, Feb — 9, Feb
Latest comments

If it easy to get Substance working with your Rome Fantasy packs after the changes to Substance? Do we still need to read instructions to get PostProcessing set up? Any other issues with installing your packs on Unity?

by Imarhiagbe Jeffry
12 hours ago

this will be just perfect for my scene


A Guide to Volumetric Fog in UE4
27 July, 2017

Ryan Brucks published a post that demonstrates some ways to create artistic effects using the new Volumetric Fog system in UE4. Some of the methods shown use existing features of Unreal, others leverage the PseudoVolume Texture support in the artist’s GDC Content Plugin. You can get the pulugin here.

First of all, take some time to study this twitch stream:

A Volumetric Fog solution gives you the ability to define fog density using HeightFog and/or ParticleSystems. It also gives fog the ability to receive shadows from the environment by compositing shadowmaps into the volume. You can boost your scenes’ quality and it’s not that difficult. 

Modifying Fog with Materials

As of 4.17, in order to use a material to write to the volumetric fog, a Particle System must be used. Any particles using a material with the Material Domain set to Volumetric will render their materials to the volume fog. The material is meant to be set up with a Sphere Mask using WorldPosition, ParticlePosition, and ParticleRadius. The documentation link above has a good example for that, so I am just going to show a few more advanced and customized versions.

When using particles to write to the fog, you must be mindful of the cost as it can get out of control quickly. The cost will be how many voxels each particle overlaps times the material instruction count. If any particle can cover the whole screen view, there better be only one particle contributing, as otherwise you are paying the cost to overdraw many times for the whole volume.

In theory it is better to use smaller localized particles to limit the area of the volume written to, but if the camera can ever go into those localized areas, the overdraw can get pretty expensive. Another approach is to use only one particle large enough to cover the whole volume bounds to just fix the cost at the worst case which is sometimes beneficial. 

The easiest way to set that up is by making a Particle System with a spawn rate of 0 and a Burst of 1. Then you need a material with MD_Volumetric. 

You might assume that to do cool things with 3D fog, you would need 3D textures. While they do help, plenty of effects can be done using only 2D textures. This fog bank over the water effect is achieved by using the ‘one large particle’ method, using a 2d noise texture: 


The material setup for the density looks like this:


This is basically custom, textured heightfog. The worldposition Z uses a linear gradient to define the density. The start of the gradient is offset by the 2D texture. The texture is mapped using simple XY world coordinates. All of the values are in world space. The above graph is for the density only (which is the “Exctinction” material pin). You may notice the fog in the above image has some subtle shading from self shadowing. That is also handled in the material.

Ryan Brucks 

Make sure to study the full guide here

Source: Shader Bits

Leave a Reply

Be the First to Comment!