For quite some time, a question has been circulating through forums and mail columns about an uncommon effect in 3d applications: How do I simulate the distortion caused by hot air masses? We've all seen this in real life - the waviness in the air during Formula 1 races, in jet engine exhaust, and above camp fires. However, in keeping with this issue's theme, we're going to use the effect in a space scene.
Rendering the background
The inputs for the displace node are relatively simple: It needs an image to be distorted, and a displacement factor in the form of a vector. In this example I've used a particle generator for each engine, which will generate a series of blak and white images for use as the displacement factor for the node. Confused? Just follow the steps and it will become clear. For reasons of simplicity and speed, this is a static scene. The spacecraft is warming up it's engines in preparation for launch, which means I only had to render the background image once. I then used that image in all of the sequence frames. The particles are the only moving element.
Load the engine_warmup_start file. The scene is set up and lit, so go ahead and hit the Render button. Keep in mind that because the scene is heavy in polygons and lights, it may take some time for the render to be completed. The upside is that it's only a one time job, and the quality of this image will greatly define the end result. So go and make that coffee, and when the image is done save it as Viper.png. You should notice that the elements making up the rendered scene are gathered in the first 3 layers, so only these layers are rendered.
Fig 1: Render layers for background.
Creating the Particles
Each engine is supposed to produce a heatwave, so we 'll give each a particle generator. Add a plane, name it Particle_emitter_1, press Alt+R to clear its rotation, rotate it so that it is in a vertical position, and place it inside the left engine just behind the blue lights that illuminate the fuselage.
Fig 2: Placing the first particle emitter
Now press F7 twice to get to the effects window, and set up a particle system with the following options (these came up through experimenting, so feel free to do so yourself too).
• Amount: 8520 (we will need quite a few),
• Start frame: -100 (we want to give the impression that the engines are already running at the start of the animation)
• End frame: 1000 (for those who want to extend the length of the animation)
Set the particles to be emitted from both Vertices and Faces, having an initial Normal speed of 0.44 and a Random factor 0.05. Remember, variation is always a must (this will cause the particles to spread out while moving away from the fuselage, just like real gas masses do).
Fig 3: Particle options
As usual, the next thing to set up is the material. Press F5, then press Halo under the Render Pipeline section. Set the Halo size to 0.180 (this size is pretty important and I will explain why later), and then set the Halo color to pure white. At this point you should alos notice that the sky color in the world buttons is black. We need all the contrast we can get from the rendered image of the particles for the displace node to give the right effect.
As a last thing, while at frame 1 press I and insert an Alpha key. Go to the frame 25, set Alpha to 0 and add another key. We do this because we want particles to fade while they move away from the emitter. Adjust the animation curve if you thinque it's necessary.
We now have a fully prepared particle generator. With that selected, press M and move it to the 4th layer. Now we need two more, for the other two engines. Duplicate (with Shift+D) the particle emitter twice and place the new ones according in their respective positions. Don't create Instances with Alt+D, since it would be a good idea to go and tweaque the emission settings for each emitter individually (to offset the start values), so that there is a unique behavior of each separate particle group for any given frame.
Set the start value for the second emitter to -104 and -110 for the third one. If everything is set up correctly, you should now have a result like this at frame 1 (only layers 3 and 4 are visible). Note: when the much awaited particle rewrite is complete -the next big thing in Blender developmentthere will be many draw option for particles(e.g crosses). For now you should be able to see all the little white dots inside the engines. Try harder...
Fig 4:All particle emitters in action
Press Alt+A to see the animation. The particles are moving away from the ship with enough speed and variation, so we are ready to render them. Press F10 and set the End Frame to 100. That should give us a 4 seconds animation, well enough to demonstrate the effect.
However, remember that we only want to render the particles, not any other part of the scene. Under the Render Layers tab, press only the 4th layer button. Then press the ANIM button to get the sequence. Even though this is a hundred frames we want, they will render much faster than the background image - it's just particles, and not that many in every frame. Once they 're ready we can move on to the really cool stuff.
Fig 5: Render layer for particles
Putting it all together
You should have now the “Viper.png” image and a series of 100 images named something like 0001.png, 0002.png and so on, presumably in your 'C:\tmp' folder or wherever you've set Blender to store rendered images at. Press Ctrl+X to clear the scene and start setting up the composition. First of all, set the output dimensions to 800x450, like our images. Then set the end frame to 100, and press the 'Do Composite' button and choose avi output format and a codec since this will be what you would call the final result.
Switch to a node type window, and press the right little button on the header that switches you to the composite node window. Next, get rid of the render result node, as we'll be working only with our pre-rendered images. Add an Input-Image node and load the 'Viper.png' image. Add the Distort-Displace node and connect the output from the image node to the image input of the displace node, then connect the result of the displace node to the composite node. Add another image node and this time choose the first particle image, 0001.png. Since this is the first of a sequence of images, we have to inform Blender of that. Press the little grey face icon on the bottom right of the Image node and choose Sequence. Now Blender will use a different particle image for every frame, another long awaited addition of the new v2.43.
Note: You have to manually define the number of images in the sequence, in this case 100. Plug the output into the vector input of the displace node, change the X and Y values to 7 (nothing too extreme, nor too subtle), and there you have it. The values of white in the particle images are multiplied with the X and Y values to give the displacement amount.
Fig 6: Primary node setup
It would be more effective visually if we weren't limited to a single displacement factor, like the sequence of particles, which can rarely be perfect. Fortunately, we can take care of this easily. We 'll use the same sequence of particles with a slight offset (2), to add some 'depth' to the displacement to cover possible 'gaps'. So add one more displace and one more image node, and set them up like this. A word of caution: the second node won't have a feed in the last two frames because of the offset, so be sure to press the 'Cyclic' button and it it will start using frames from the beginning when it runs out.
Fig 7: Secondary node setup
Notice that the second displacement has multiplier values of 3, instead of 7, as it is only a 'support effect'. Also, we wouldn't want it to cancel out the effect of the first node in any way. You are now ready to press the ANIM button once again. When the video is ready you can set your medía player to loop playbak and play the file. The particle movement is random anyway, so you won't be able to tell where the video starts or ends.
Things to pay attention to
As I explained earlier, the amount of white on the image that is used as an input to the displace node (or better, the amount of luminosity) is what defines how much displacement there will actually be on the image.
A more important thing for the effect we want, however, is a constant change of color values at any given part of the particle images. It's not enough to have a white area in the picture all along the sequence, because that will mean a constant displacement. During the animation it will look like there is no displacement at all! What we really need is a constantly changing displacement. This is why we need a relatively small particle size, so that white will constantly alternate with black, or values in between, providing the flicker effect in the image. This example will make things more clear
The image on the left shows our current particles with a size of 0.180 (material buttons). On the right they are rendered with a size of 0.280. In the areas marked red, the color will be mostly white throughout the sequence, so it will not give the desired effect.
Fig 8: Halo size difference
Keep in mind that the displace node can alos use geometry as input, not just images, which widens its range of use even further. This makes it a very important addition of the new versión of Blender. A practical application of this could be the “invisible man“ effect, or anything else that makes it's presence 'perceivable' only by distorting it's background. Use your imagination, and keep blending!
Thanks to the people of BlenderGalactica.com for the fine models of the Viper and its surroundings.
The Node Displacement in action.
Kostis Karvouniaris I'm a 25 year old law school student from Greece. I have been using Blender as a free time hobby for about 4 years, and I'm still amazed by the leaps in development.