Learn

How to create smoke & fog in Unreal Engine

Guillaume Chichmanov
|
July 17, 2024

This tutorial was written by Ignacio, environment artist at Cominted Labs. Throughout this blog post, Ignacio will guide you through the basics of creating an initial scene and a simple shader capable of producing smoke or fog effects with minimal requirements.

1. Creating a Level Scene

To start, create the level and ensure it includes the default necessary lighting elements and a post-process volume.

2. Customizing the Level

Next, add assets, different lights, and configure the directional light, skylight, fog, and post-processing according to your needs. The post-process volume is crucial as it offers various Unreal lighting methods, denoisers, and other effects such as exposure, vignette, lens flare, and bloom.

3. Creating a New Material

Right-click on the content drawer to bring up the menu and create a new material for the smoke shader.

4. Changing Material Properties

Upon opening the material, change it to translucent and unlit. This ensures it won't receive lighting from other sources but will feature an emissive channel that generates its own light.

5. Basic Nodes Needed

Smoke requires two basic components: a texture indicating where it's visible and movement. Start by adding a texture sample node with noise, like Perlin or Voronoi. A cloud texture is recommended, along with a panner node to provide movement. Another crucial element is determining the intensity of the smoke using a camera depth fade node.

6. Adding Variables and Multiplication

So far, the main nodes and a texture providing a value between 0 and 1 have been placed. Now, multiply those values by a color. Add a three-value variable (RGB) by holding down the number 3 on the keyboard and left-clicking the mouse. Assign the desired color for the fog and add a multiplication node.

7. Adding Variables to Control Material Parameters

The shader requires another multiplication to increase the intensity of the emissive channel. This allows the shader to emit more or less color and light, multiplied by the camera depth fade nodes to provide opacity. Add a single-value variable to adjust the material's opacity by pressing the 1 key and left-clicking the mouse. Adding multiple single-variable nodes provides greater control over different material parameters, allowing future instances of the material with different looks by customizing these parameters.

8. Fixing Edges

The material appears suitable but has an issue with the edges disappearing abruptly. To achieve a better result, generate a mask connected to the opacity channel, transitioning from 1 (visible) to 0 (invisible). This can be done by generating a texture where the edges transition to black and the center is white.

Alternatively, achieve this by subtracting the x-1 node from each edge mathematically, then utilizing the mask node. This approach produces a smooth transition.

9. Creating a Plane Mesh in the Scene

With the shader material created, save it and return to the scene. Add a plane mesh.

10. Replacing Material on the Plane Mesh

Once the plane mesh is generated, replace its material with the smoke shader, and voilà!

Conclusion

By following these simple steps, you can create shaders that produce stunning visual effects without the need for VFX and with optimal performance for video games and real-time rendering in Unreal Engine. From setting up your initial level and customizing it with various assets and lights, to creating and fine-tuning a smoke shader with precise control over material parameters, this guide lays the foundation for more advanced projects. Whether you're developing video games, virtual environments, or cinematic experiences, mastering these fundamental techniques will enhance the quality and realism of your work. With practice and creativity, the potential applications are vast, enabling you to bring your visions to life in vivid detail. 

If you are building a game and looking for an efficient and cost effective outsourcing partner, Cominted Labs is at your service. We are a leading game art outsourcing platform that has collaborated with over 50 leading game publishers and developers.

Contact us today and book an intro call.

Share this article

Related Articles