# Blender 3D: Noob to Pro/Advanced Tutorials/Advanced Animation/example/Cutting Through Steel

| previous module: "Working example: Piston, Rod and Crank" | • Table of Contents • Glossary | next module: "Advanced Game Engine" |
In order to simulate a laser beam which is cutting through a steel plate, we have in Blender (at least) two possibilities:
* an animated Mesh with many Shapekeys
* an animated texture
The latter method is considerably easier to implement and the result is nevertheless convincing enough. We will proceed as follows:
* You need an animated alpha mask for the points at which the metal is changed. For this use a text object as a path. A cube follows the path and emits a particle system. The results are rendered as animation and the images stored.
* Then load these pictures and use them as an animated texture on a plane.
* With a second particle system the sparks are simulated.
* With a third particle system we simulate the annealing of the weld. Again, this sequence is used as an animated texture.
* Smoke is created with a fourth particle system.
The result is shown in Fig. 1.
This guide is based on the well-known tutorial Cutting Through Steel, but remade with the current Blender particle system and with constraints. You need to have basic knowledge of Blender.

## Creating the Alpha-Map

* Start Blender. Save your file. Delete the cube.
We should save the file right at the beginning, because we will save the animated textures in subdirectorys to the current directory. Particle caches are also created as subdirectorys.
* Set the End value to 150 in the Anim panel of the Render buttons. This allows you to specify the total length of the animation.
* In the Output panel use "//AlphaMap/" as output directory. When we render the animation the images are than saved in the subdirectory "AlphaMap" to the current directory.
The animated alpha map consists of gray-scale images whose luminance information is used to calculate the mask. Bright pixels produce transparency, dark pixels remain opaque.
* Use PNG as output format. This avoids compression artifacts wich occur with the JPEG format.
I've left the resolution at 800x600, but you need to set your desired resolution here.
* Create the shape you want to cut out as Curve object, or use a text object and convert this to a curve. I've done the latter, I've used a text-object (a "W"), and converted this to a Curve object (Object-> Convert Object Type ...-> Curve).
* With the function Center in the Curve and Surface panel I've brought the object in the middle of the 3D-coordinate space.
* The filling of the object is not needed here, therefore activate the option 3D for the curve object, even though the object should remain two-dimensional.
Now we need again a cube. The cube will follow the curve. It's particle system will create a glowing trail, that is later used as alpha map.
* Insert a cube.
* Scale the cube as small as the track of the laser beam (the welder) shall become.
* Select the cube, than also select the curve object with Shift-RMB.
* Ctrl-P->Path Constraint creates a Follow Path constraint.
* Select only the cube and activate the option CurveFollow in the Constraints panel in the Object buttons.
If you press Alt-A now and let run the animation, the cube will follow the shape of the curve object, but not necessarily in the desired direction and not from the desired location. So some work needs to be done:
* Change to the Edit mode of the curve object.
* Curve->Toggle Cyclic opens the curve object, by adding (Subdivide) of one or more control points you achieve the desired movement. W->Switch Direction reverses the direction of the motion of the cube.
By adding a Time Ipocurve to the curve you could set the duration and speed of the animation, but I've left the preset duration of 100 Frames. The last 50 Frames the path will glow a bit and the smoke will vanish.
* Add a particle system to the cube, call this Alpha.
* Set the particle lifetime to 150 (or higher) (Fig. 2b). The particles will live the entire length of the animation.
* Bake the particle animation.
* The cube gets a material:
** Halo
** RGB 1/1/1, that is completely white
** XAlpha
** HaloSize: 0.03
** Hardness: 40
I want to achieve with these settings, that we will get a grayscale image, that is completely white where the material shall become transparent. We don't need partial transparency, since a relatively sharp cutting edge shall be created. Slight irregularities in the periphery are wanted.
To render the animation, the camera is centered directly over the object.
* View->Top
* Strg-Alt-Num0 sets the camera to the current view. Select the camera.
* With the Transform Properties panel in the 3D-window (Object->Transform Properties) set the coordinates of the camera exactly vertically above the center of the 3D window (X/Y=0).
* In the Editing buttons of the camera set the option Orthographic in theCamera panel. Scale the size of the animation with the Scale value.
* The world color to black in the World buttons.
* Render the animation.
Blender now generates an image sequence from 1 to 150 in the subfolder AlphaMap (Fig. 2c).

## Welding sparks

Now we'll create a new scene, in which the different effects are joined.
* Rename your current scene to AlphaMap.
* Create a new scene as FullCopy (Img. 3a). Name this new scene Cutter.
The welding sparks are created using a particle system.
* Add a UVSphere with 16 segments and 16 rings.
* Delete the lower half of the sphere in Edit Mode and scale it to approximately the same size as the cube.
* Switch to Object Mode.
* Select the cube in addition to the sphere. Copy the Follow-Path-Constraint from the cube to the sphere.
Note that you copy attributes from the active to the selected objects. The active object is the one you've selected last
Noob Note: Using Blender 2.65, the easiest way I found to do this was to use the '3D View: Copy Attributes Menu' addon. (To enable the addon press Ctrl+Alt+U to bring up User Preferences, click the 'Addons' tab, type 'copy' into the search box, located at the top left of the tab, and put a check in the box to the right of the addon that's found, '3D View: Copy Attributes Menu'.) First RMB click the sphere, then Shift+RMB click the cube, the one with the follow path constraint. With the 2 selected press Ctrl+C and choose 'copy object constraints' from the popup menu. If the sphere gets offset in the process, just move it manually to the position of the cube or the first waypoint on the path.
* Create a particle system for the sphere.
** Name Sparks
** Amount: 4200
** Life: 5
** Emit From: Random/Verts
** Normal: 0.757
** Random: 0.397
** Rotation Random: 0.116
** AccZ: -1.37
Except for the lifetime the values are relatively arbitrary, I have just experimented with the values until I was halfway satisfied with the results. The sparks have a slight acceleration in negative Z direction to sink down.
* Visualization:
** Line (which corresponds as much as possible to the setting Vect in the particle system before 2.46)
** Speed
** Back: 0.04
** Front: 0.0
You achieve a long spark with these settings.
* Bake the particles. Change to the Bake panel and click on the Bake button. The particle animation is now permanently saved.
The Bake end value is also the final value for the normal particle animation, even if you don't bake. If you need more than 250 frames, you need to increase this value.

## Using the alpha map on an object

The alpha map is now used as texture on a plane. Therefore we have to position the texture exactly like the previously rendered animation, so that the sparks run in sync with the blending out of the plane.
* Add a new plane to your scene (Add->Mesh->Plane).
* Scale the plane at about twice it's size - as big as you need it for the final shot.
The main problem is now to fit the texture exactly to the plane. We will give the plane UV coordinates, than fit the plane to the ratio of the texture and finally adjust the position in the 3D window with UV coordinates.
* Switch to Draw Type Textured (Fig. 4a).
* Split the 3D window, and open in one part the UV/Image Editor.
* Switch to edit mode of the plane.
* Unwrap the plane ((Mesh->UV Unwrap).
* Load an image of the alpha map in the image editor (not the first one, so you can see the course of the map).
Normally the texture is not orientated the way I would like it to be.
* Click the padlock icon in the toolbar of the UV/Image Editor (Update other windows in real time).
* Rotate the UV vertices in the UV/Image Editor until the texture fits (e.g., while holding the Ctrl key)
* Switch to object mode.
* Add a new material to the plane and name it Rust.
* Select the fifth texture slot and add a new texture. Name it AlphaMap with the parameters:
** Map Input: UV
** Map To:
*** Alpha
*** Spec
*** Nor
*** NoRGB
*** DVar: 0
With these (Fig. 4b) settings we achieve, that the white pixels in the texture set the Alpha and the Spec value to zero (DVar). Because the texture delivers RGB colors we have to activate NoRGB, because we need intensity values. We don't need RayTransp, because the world background is black anyway. We can't use ZTransp, because Halos are not rendered in front of materials with ZTransp (probably a bug in Version 2.48a). With Nor we get a 3D effect.
* Switch to the Texture buttons.
* Type: Image Texture
* Load the first image of the alpha map sequence.
** Image: Sequence
** Frames: 150
** Map Image: Extend (Fig. 4c)
Now we adjust the UV coordinates.
* Object->Transform->Scale to Image Aspect Ratio. This scales the ratio of the plane automatically to the aspect ratio of the image texture.
* Change to a frame where you can judge the particle animation and it's fitting to the texture.
* Switch to edit mode. Scale the UV coordinates in the UV editor until the texture fits to the particles.
* Switch back to object mode.

## Material for the plane

We will now give the plane a better material. To judge the material we will first re-focus the camera, give it a texture and make some material settings. If you already have a good metal material, you can use this of course directly and use the Alpha texture from above on your existing material.
* Select the camera.
* Turn Orthographic in the Camera buttons off.
* Position the camera as desired.
* Select the plane.
** I've used the rust texture that is linked at the bottom of the page as image texture.
*** Map Input: Orco, SizeX/Y each 0.5. The size change is to use a larger part of the texture on the final image. But this depends on the size of the camera and the texture.
*** Map To: Col/Nor
** In the second texture slot I've mapped a Stucci texture to Spec.
*** This abridged sentence means: select the texture slot. Set Map To to Spec. Deselect Col. Change to the Texture buttons. Select Texture type Stucci.
** The Specularity is thus determined by a texture. The spec value is increased by the texture (DVar=1). Therefore you have to set the Specularity in the Shaders panel to the smallest value the material shall have (e.g. 0.08).
If you have done a test render, you'll see that the particle track of the cube is still there.
* We don't need the cube anymore, you may delete it. In the Scene Cutter we use the already generated AlphaMap.
Texture with OSA (Antialiasing) are somewhat blurred, for our purpose we use CatRom instead of the default Gauss method.
* Set in the Render panel CatRom as AntiAliasing filter.
We need a new output directory for the animation, to not overwrite the AlphaMap we've created earlier.
* Set the output directory to "//Render/" in the Output panel.

## Lighting the torch

The torch itself shall cast light, therefore we parent a Lamp to the Sphere and animate the energy of the lamp.
* Change to frame 1.
* Select the Sphere.
* Place the 3D cursor on the Sphere. Object->Snap->Cursor to Selection
* Add->Lamp->Lamp
* Select the lamp in addition to the Sphere.
* Object->Parent->Make Parent->OK
* Select the lamp and move it a bit up (i.e. in positive z-direction). The lighting shall emit from the sparks, not from the hole.
I find it cumbersome to animate the energy of the lamp by setting ipo-keys in the lamp buttons. Instead I do it directly in the 3D window.
* Change to the Ipo Curve Editor in one of the open windows.
* Change the ipo type to Lamp.
* Activate the Energy channel with LMB click in the ipo window.
* By holding Ctrl key pressed, you create by left-clicking in the ipo window the points of the ipo curve.
These values may be larger than 1. However, the last maximum value should be reached in frame 100, and decrease significantly to frame 105. The sparks are only issued up to frame 100, and live up to the 105th frame. After that the metal is glowing a bit.
Your result may look somewhat like mine in Fig. 6. If the amplitude of the curve is not large enough, you can scale the ipo curve at the y-axis.

## More realistic sparks

You may animate the material for Line visualization during the lifetime of each individual particle if you use Halo for the material, so you could change the sparks color from white to red.
We will show this in the next step, but confine ourselves here to make a better, not animated material (Fig. 7).
* Add a material to the Sphere, name it Sparks.
* Activate Halo in the Links and Pipelines panel.
* Set the RGB color for Halo to white.
* Activate Lines/X Alpha/Shaded in the Shaders panel.
* Halo Size: 0.1
* Add: 0.8

## Smoke

Now were going to create an individual material animation for every particle during its own lifetime.
We will use particles with a simple texture and animate the alpha value of the material. We're going to duplicate the Sphere and give it a new particle system.
* Duplicate the Sphere with Object->Duplicate. The new sphere already bears the Path constraint.
* Remove the Sparks system from the new Sphere.
* Create a new particle system. Name it Smoke.
* Amount: 300
* Emit from: Random/Verts
* Initial velocity:
** Object: 0.02
** Normal: 0.1
** Random: 0.01
* AccZ: 0.05
* Bake this particle system.
* Change to the Material buttons.
* Create a new material and call it Smoke.
* Alpha: 0.034. This is the basic visibility for the smoke texture.
* Add an ipo key for Alpha in frame 1.
* Change to frame 100.
* Set Alpha to 0.0 and add the second ipo key.
Now the smoke will disappear within the lifetime of each particle, independently of the lifetime of the particle.
* Halo
** Halo Size: 0.224
** Hard: 12
** Add: 0.014
** Halo Tex This is the crucial setting to use a texture for the shape of the halo.
** X Alpha
* Create a new texture, you may also call it Smoke.
* Texture Type: Image
* Load an image with random, smoke-like structures, like that from Fig. 8b.
If the fading goes to quickly, or the texture is to transparent / opaque, change the animation of the Alpha value.
You see, even though we use only a few objects and materials, it is extremely helpful if we designate meaningful names to the objects, materials, textures etc.

## After Glow

Now at last we will create another animated texture, that shall simulate the annealing of the steel plate after it is being cut through.
* Change to the scene AlphaMap.
* Add a new scene again as a Full Copy.
* Name this scene Glow.
* Enter the output directory "//Glow/" in the Output-Panel of the Render buttons.
The texture shall have nice semi transparencies.
* Therefore we select a different output format in the Format panel, namely RGBA (RGB with Alpha).
* Selecting Premul in the Render panel the world background will become fully transparent, and the particle trace semi transparent.
We use the existing particle system, but change it's material settings.
* Call the material of the cube Glow.
* Increase the HaloSize to 0.04. Our new texture has to be larger than the cutout of the plane, else it will not be visible.
Now we're going to animate the material of the halos. Again this works only because we have Point visualization of the particles.
* Change to frame 1.
* Set an IPO key for the RGB color (here white).
* Go to 3rd Frame.
* Change the Halo color to 1/1/0.42 (light yellow). Set the next IPO key.
* Go to 6th Frame. Change the Halo color to 1/0/0 (red). Set the next IPO key.
* Go to 11th Frame. Change the Halo color to 0/0/0 (black). Set the next IPO key.
The particle trace will fade out during 11 frames.
* Render the animation.
* Go back to the scene Cutter.
* Select the plane.
* Load the newly created texture in the third texture slot as an animated image texture.
** Add New. Name the texture Glow.
** Map Input: UV
** Map To: Col/Emit
We need the alpha values in the image for changing the emit value. Also the alpha blends the glow texture nicely with the plane texture.
* Texture Type: Image
** Select the first image from the subdirectory Glow.
** Activate Sequence.
** Frames: 150
** Extend
The settings for the texture are identical with those of the texture AlphaMap ('Fig. 4c), except of course for the directory in which the images reside.
In Fig. 9b, see a finished frame of the animation. For the video in Fig. 1 I've changed the animation a bit, scaled the emitter objects a bit smaller, changed the sparks Color and used a different camera perspective.
Suggestions, critics and approval please write on the commentary page of this article. If you find some obvious mistakes you may correct the article directly of course.
* Rust Texture
| previous module: "Working example: Piston, Rod and Crank" | • Table of Contents • Glossary | next module: "Advanced Game Engine" |