Charles Thomas's Website


Smoke Shader inside UDK

06/02/2015


Recently I was working on a smoke shader for a game I'm working on.
While trying to figured out how to do spherical particle lighting, I came up with a really simple solution.
To get more control over lighting I used MLM_Custom and as you can see below the material is quit simple.

So how it works ? Basically all the magic come from this tangent spherical normal texture. It allow me to approximate the lighting as a volume.

I combined it inside the material with a normal I made from the smoke alpha (I used crazy bump then modify it a bit inside photoshop).
The reason behind this was to get a bit of details around the edge.

I choose the Half Lambert (from Valve) to approximate the diffusion of lighting inside the smoke and combined it with a lerp to a classic Lambert then I can change the amount of light going through the smoke by changing a scalar parameter.

First iteration was using hemispherical lighting for the ambient light but where it looks really good in a particular setup, it doesn't with an other. Finally I used a single color (Diffuse color) and plugged it to the CustomLightingDiffuse input. With normal also puggled to the Normal input it worked perfectly.

This is how it looks inside UDK with a simple lighting setup :

Image from left to right shows a SubSurfaceScattering value of 0, 0.5 and 1.

And in motion :

So far it looks great but there's lack of shadows as it is a transparent shader it can't cast or receive any.
Also I don't take into account the distance travelled by the light.

I will maybe make an other blog post later with more effect like back scattering, and maybe a better way to approximate sub subsurface scattering inside smoke.

Hope you like this first blog post, Thanks !