A Guide to Volumetric Fog in UE4
Events
Subscribe:  iCal  |  Google Calendar
Utrecht NL   29, Jun — 30, Jun
Brighton GB   10, Jul — 13, Jul
Brighton GB   10, Jul — 13, Jul
Cambridge GB   13, Jul — 17, Jul
San Diego US   19, Jul — 23, Jul
Latest comments

AI applications are only beginning to materialize. It's so exciting what neural networks will do to art workflows in the coming years.

W T F!!! Why, really don't understand, EA = just a fucking looser company!

Amazing... Congratulations for the new way to show information.. I hope they could use this to teaching.

A Guide to Volumetric Fog in UE4
27 July, 2017
News

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: 

Fog_01

The material setup for the density looks like this:

2d_noise

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!

avatar
wpDiscuz