.vanaarde

Wispy Smoke

Posted on June 3, 2023  •  4 minutes  • 672 words  • 
Table of contents

Wispy Smoke

I wanted to add some simple cigarette smoke the scenes to give the environments a bit of extra life and came across a technique that work really well for our use-case; we only needed a static effect (no real-time character interactions required). Unfortunately I was unable to find the original post that inspired this effect but if I come across it again, I’ll definitely drop the link here to give credit where credit is due.

The Ingredients

For this setup we’ll require a vertically tileable texture, a material to distort, scroll and erode the texture, a VFX mesh that looks like it could be an ear trumpet, and a Niagara system where we’ll be spawning wispy-textured ear-trumpet-shaped meshes on particles to bring it all together.

Tileable Texture

For this tileable texture, I started out by making a paint strokes with flame painter. I then took the result and applied some elbow grease in Krita to make the texture tileable.

Tileable smokey looking texture.

VFX Mesh

The mesh construction in Houdini was done using a curve as the spine for the sweep operation, a ramp parameter to easily control the profile / tube size, and a distorted V coordinate (also controlled through a ramp parameter). Setting up the mesh construction in a procedural manner (including material preview directly in Houdini) allowed me to quickly try out multiple variations of the tube profile and V coordinate distortions until I found the combination that I liked.

SmokeWisp mesh created in Houdini

One of the key ingredients to this cone-shaped mesh was to compress the V coordinate towards the top of the mesh.

Ramped V coordinates

The combination of the mesh shape and ramped V coordinate creates a nice effect of the smoke slowing down and spreading out as it rises.

Unreal Material

It’s time to bring this into Unreal. We’re going to need a material that not only mimicks the behaviour tested in Houdini but also has support for some Dynamic Material Parameters so that we can control the material behaviour from a Niagara particle system.

The material starts by scrolling the UV coordinates along the V, then “rotates” the texture (ever so slightly) around the tube by adding a V-scaled offset in the U direction.

A fresnel mask is used to soften the edges and the

The trick with the rotation, same as the distortion, is to only apply a very small amount to give the smoke just a tiny extra movement, making it feel more organic. If you push the rotation too much the movement starts to look unnatural.

Material for Niagara mesh particles

The material scrolls the texture along the V coordinate and erodes the texture towards the top.

Niagara System

And finally, we have a niagara system to spawn overlapping VFX meshes, and grow them over time. Each wispy smoke particle uses a Mesh Renderer component to instance the VFX mesh, combined with a randomized UV offset for the texture to avoid obvious visual repetitions. Each particle will also apply additional erosion / decay (using Dynamic Material Parameters) based on the particle’s normalized age to ensure the smoke fully dissipates before the particle dies.

And that’s all there is to it. Just drop the Niagara System into a scene and watch it go!

Thoughts

The approach discussed here is a very simple and lightweight solution to creating a wispy smoke effect. It worked well for our use case in Glimpse since we only had a sidescrolling-style camera to deal with. For other camera styles, the mileage may vary.

Some improvements that could be added to this effect in its current form would be to try using two layers of smoke textures that move independently to break up the shapes a bit more.

The downside to this technique is that it is very static (there is not much in the way of designer-tweakable parameters) and is not suitable for situations that require dynamic smoke / character interaction. In the future I will certainly try a variation of this technique using Niagara particle ribbons that would be more suitable for dynamic use cases (trailing wispy smoke in real-time).

Follow me

I sometimes post gamedev stuff on these social media things