Friday, January 8, 2010

Animated Procedural Textures

Join my Blender 3D forum where you can network with other Blender friends and get your Blender 3D questions answered.

Download the blend file

My last tutorial demonstrated how to animate object location, using Insert Loc keyframes from the 3D window, manipulating curves in the IPO Curve Editor, as well as how to use IPO drivers and PyDrivers. You might get the idea that location, rotation, and scale are the only things you can animate. In fact, there are many other areas in which you can animate. In this tutorial, I will show how to animate a procedural texture to create a wavelike or moving cloud effect. This technique is based on the excellent series of tutorials by Colin Litster, at If you really want to create a realistic ocean effect, make clouds float by realistically, make a flag wave, and so on, you should check out all of Colin's tutorials. This techniques has become very popular in the Blender community. Colin been a driving force in the Blender community for a long time.

Blender's textures come in two forms, procedural and image. If you've worked with Blender for even a short time, you've probably encountered the Image texture, which is simply the projection of a 2D image into an object, such as a plane. Image textures are non-procedural. The image, what you see, is what you get. Procedural textures are really little programs that you can tweak to get a particular special effect. One of the most commonly used procedural texture is Clouds. We're going to animate the Clouds procedural texture, projected onto a colorless, shadeless plane, to produce a wavelike effect.

You can download the blend file that I created, that you can use in your own projects and share freely. You can find the link at my blog,, where you can also read the script for my tutorial, as well as the scripts for all the tutorials I've published.

So start with the default Blender scene. Delete the default cube (Right click to select, press the Delete key, then Enter to confirm). Add a plane (Space - Add - Mesh - Plene). Scale it 3 times (S - 3 - Enter). Orient the camera so that it faces the plane (View - Align View - Align Active Camera to View, or press Ctrl - Alt - Num 0). Scale the plane in the X and Y direction so that it fills out the outer dashed line rectangle. This will ensure that the camera sees the entire plane, without the background rendering.

Press the Shading button (F5) and use the default material (Material). Press F12 to render. The plane renders with the default gray color and the specular highlight. We're going to make the animated procedural texture control both the shape and the color of the rendered plane. To get rid of the specular highlight, click the Shadelees button. Press F12 to render. In the Map To panel, all the way at the right, make the color black.

Press F6 or click on the icon next to the ball to go to the Texture buttons. The first texture channel (channel 0, technically, we need to remember that), with the word Tex is selected. The texture we select will be mapped to that channel. There are 10 texture slots. We can blend all sorts of textures (images, clouds, blending types, and so on) using these slots. We'll use the default Channel 0. From the Texture Type dropdown, choose Clouds. You can control how the clouds look using the sliders and the various types of noise, such as soft noise or hard noise. Accept the defaults. You can play with these later to get the effect you want.

Press F12 to render. You get a sort of black and white wavy picture produced by the clouds texture. We are now going to animate this so that it looks like real waves. Split the 3D view. From the bottom border of the window, right click when you see the double arrows. Select Split Area. Move the cursor to where you want the view to be split. Press Enter. Then change the type of the newly created window at the right to IPO Curve Editor.

We're going to work with the IPO Curve Editor in full screen mode. To do that, position the cursor inside the editor area and press Control- Down Arrow. The IPO Type is set t Object by default. There are other types that can be set. Change the IPO Type to Material. Note on the right all the different things that can be changed - red, green, and blue channels, the alpha (for transparency), specularity, hardness, and so on.

We're going to change two offsets, the X offset (OfsX) and the Z offset (OfsZ). The X offset controls the track of the texture across the Z axis, making it seem to move across the window. The Z offset changes the shape of the cloud/wave texture. We'll animate this over 100 frames. Start with OfsX. Left click OfsX. Zoom the view using the Num+ and Num-, so that you can see the 1 and -1 values on the right. These represent the number of blender units to offset as the animation proceeds. At about Frame 1 (it's not necessary to be totally exact), with the value at -1, press Control-Left Click. A horizontal curve is created. Go to Frame 100 or so. Control-Left Click where the value is 1.
You now created a Bezier curve interpolated between those two values, for the 100 frames. To make the curve interpolate linearly, go to the Curve menu, then select Interpolation, then Linear. We can extrapolate this line both forward and backward in time by selecting Curve - Extend Mode - Extrapolation.

We'll do the opposite for OfsZ, going from 1 to -1. Shift-Left Click OfsZ at the right. At Frame 1, find the value of 1, and press Control-Left Click. Then go to Frame 100. Find the value of -1, and press Control-Left Click. Then go to the curve menu and change the interpolation to linear. Finally, from the Curve Menu, we'll change Extend Mode to Extrapolation. We now have our two curves created.

Press Control-Down Arrow to return the IPO Curves Editor back to its original position. We can't see the animation effect in the texture with Alt-A. We need to actually animate the scene. To do that, go to the Scene buttons by pressing F10. Change the end frame to 100. Select the Preview preset by pressing the Preview button, all the way at the right. Just for this demo, we'll animate this as a series of JPEGs. You can create a video out of this by selecting AVI or MOV format. So press the ANIM button to animate. Looks sort of wavy, doesn't it?

We can make it a bit more realistically water looking. To do that, select the Material buttons, go to the Map To panel, and change the color to something bluish. Press F10 to go back to the scene buttons. Then press ANIM.

That's it! You're now an animated procedural texture guru. You might also tweak the clouds setting, especially the noise type and amount, or try some of Blender's other procedural textures. If you liked this tutorial, be sure to hit the Youtube SUBSCRIBE button so you won't miss any of my future videos. Happy Blendering!