- The Blend
- Posts
- The Fog Rolls In
The Fog Rolls In
Make animated fog without complicated simulations
We're growing fast. There's a bunch of new subscribers today—welcome everybody!
In The Blend, we break down 1 Blender technique each week in a micro-lesson.
The Blend aims to become the world's #1 Blender newsletter. I really appreciate you coming along for the ride!
This was gonna be an animation but it was wayyy too big to fit here :(
The hero slams the door open.
He dashes out into the night. He can hear the police sirens now.
They're getting closer.
He sees them as they round the corner: lights, flashing red and blue in the heavy fog.
He crouches behind a parked car, breath swirling in the cold.
The flashing colors move past, slowly, illuminating the drifting fog above him. Red, then blue, then red. Slowly, they fade away.
He's safe.
My quick try at a "movie" scene.
Tried to use fog to add atmosphere. Everything's better with fog, right?
Of course.
But the fog here is different. It's more realistic.
It moves around. It swirls. It drifts. It blows in the wind.
Real fog is never still. Ever. It moves in even the slightest air currents.
Fog doesn't always have to be moving, though. It's only really noticeable when there's a lot of fog.
If you're just making a room with dust in the air, you don't need to worry about moving fog.
But a police chase scene in the dead of a foggy night? That fog needs to be moving around.
In 3D, it's not easy to make animated fog. Usually it's done with a smoke simulation.
But a simulation takes forever to get just right. You have to set it up, bake it, tweak it, repeat. A lot.
In some situations, that's just overkill. All you need is a bit of animated fog. You don't need a whole simulation.
There's a hack you can use for these situations:
Noise textures.
That's right—the good old Noise node. We can use it to make a quick little shader that'll give you some pretty nice fog. Then I'll show you how to give it automatic animation.
First, make a big cube around your scene. This is the object you'll put the fog shader on. (More on that here.)
Now you need to make the material.
It's really simple:
The node setup—only 6 nodes. Easy.
Principled Volume: the actual fog. I didn't change a thing on this. Just make sure it's hooked into the Volume socket on the Output node.
Noise Texture: Plug this into the Density of the Volume node. This will control the density of the fog. Where the Noise Texture is white, the density will be 1. Where it's black, it'll be 0.
ColorRamp: The Noise Texture by itself doesn't quite work for the density, because it leaves us with a fog that's too uniform and too dense. I moved the black stop to add more contrast. I turned the other stop to a low gray so the fog wouldn't be as dense. Mess with these both—it'll be different for different scenes.
Mapping/Texture Coordinate: Lets us adjust the position of the Noise Texture by adjusting the Location of the Mapping node. If you have Node Wrangler enabled, you can just select the Noise node and press Ctrl + T to autogenerate these nodes.
By the way, you really should have the Node Wrangler add-on enabled (more on that in the future.)
Now you have some fog. Noisy fog. The last step is adding animation.
See how the W field on the Noise Texture is purple? That's because there's a driver in it.
I'd better explain what a driver is:
Drivers
Drivers are expressions that control values in Blender. You can put a driver into almost any editable value in Blender.
Drivers are written using simplified Python syntax. They can get pretty complicated, but we're going to keep things easy.
To add a driver to any value (say the X position of a cube) simply type '#' into the field, followed by the expression.
Your expression can use any common operators, like +, -, /, and * for math. You can also use the word 'frame' to get the current frame.
Try typing this into an object's X postion: #frame/200.
Press play. The cube will move on the X axis, because its X position is set to the current frame number divided by 200.
Now let's use this trick to animate our noise.
Put the exact same expression, '#frame/200' in the W setting of the Noise Texture. (If you don't see a W, switch your noise to 4D.)
Now, when you hit play, your fog will move gently. Try a higher or lower value instead of 200 to adjust the speed of the animation.
You can also make the fog drift in a specific direction by adding a driver to any of the X, Y, or Z positions in the Mapping node.
You could also make the number negative (for example -200) to make it animate in the other direction.
That's it. Mostly-believable animated fog. Something you know how to make now.
You just learned:
Why static fog isn't enough
How to make a shader for animated fog
How to animate it using drivers
Thanks for reading.
Have a great week. I'll see you again next Monday!
P.S. I also write fiction—over at Voyage. Head over there if you're up for getting lost in some good stories.
Weekly Render Prompt
This week, try making:
> A device for communicating. Anything from a wizard's smartphone to a good old semaphore tower. 📞📱
The Fine Print
Know anybody who likes Blender? They'll probably think you're awesome if you forward them this email.
If someone forwarded this to you, then sign up here—unless you trust them to forward it again next week!
P. S. Have a topic you want covered? I'm always open to new ideas—reply to this email with your suggestions!
Reply