house explosion

Here’s a way to build a simple explosion. It’s tedious and shows how effects work doesn’t come at the push of a button! Have fun!

Let’s get started, we’ll make an explosion that looks like this (click on Quicktime logo)

1. Start Maya. Delete the preference folder and restart Maya if you like (it always ensure that no previous tool settings are left from other sessions).

2. Download the starting file here, create a project folder and open the file.

3. Turn off the construction history by clicking this button (see below). Turn on face selction (by using the toolbar or right clicking onthe house). Select a part of the house as shown below:

turn off history button

4. Turn on Polygon > Tool Options > Keep Faces Together and do Edit Polygons > Extract (with the Separate Extracted Faces turned on). The house object is then split into two objects. Select the smaller one, rename it and center its pivot. Choose the Move tool and enter 0 0 0 in the Numeric Input: Absolute Field, write down the translation values, Freeze the transforms and enter the negative of he transformation values you just wrote down.It’s tedious after a while and it can be automated by using the following MEL script (from the original tutorial):

string $sel[], $par[], $child[], $cmd;
int $numsel, $i;
float $xpos, $ypos, $zpos;

$sel = `ls -sl`;
$numsel = size($sel);
$cmd = "polyChipOff -kft on -dup off -ch off";
for( $i = 0; $i < $numsel; $i++ ) $cmd += " " + $sel[$i];
eval($cmd);
$par = `listRelatives -p $sel[0]`;
$child = `polySeparate -ch off $par[0]`;
$par = `listRelatives -p $child[0]`;
ungroup $par[0];

$xpos = eval("getAttr " + $child[1] + ".boundingBoxCenterX");
$ypos = eval("getAttr " + $child[1] + ".boundingBoxCenterY");
$zpos = eval("getAttr " + $child[1] + ".boundingBoxCenterZ");

select $child[1];
rename Debris1;
move (-$xpos) (-$ypos) (-$zpos);
makeIdentity -a true;
xform -piv 0 0 0;
move $xpos $ypos $zpos;

5.Break off as many pieces as you want using this procedure.

6. Now let’s start with the dynamic set up. AS usual with dynamics make sure your playback speed is set to every frame.

7. Make the ground plane a Passive Rigid Body with the following settings:

Static/Dynamic Fristion: 0.8

Bounciness: 0.5

Collision Layer: -1

8. Open Solvers > Rigid Body Solver and set

Step size: 0.01

Collision tolerance: 0.01

Start time: 10

Solver method: Runge Kutta Adaptive

9. With nothing selected create a Gravity Field (magnitude 40) and a Drag Field (Magnitude 0.2)

10. Pick a piece of debris and make it an Active Rigid Body with the following settings:

Static/Dynamic Fristion: 0.5

Bounciness: 0.3

Collision Layer: 1

initialVelocityX: -1

initialVelocityY: 8

initialVelocityZ: 28

initialSpinX: 400

initialSpinY: -150

initialSpinZ: 0

applyForceAt: CenterOfMass

11. Link the debris object to the gravity and teh drag field and play the simulation. Adjust initial spin and velocity. Also play it in real time to see the speed. Bake simulation when you’re happy with the motion (Edit > Keys > Bake Simulation with the rotate and translate selected in the channel box) When the baking is done do Edit > Delete by Type > Rigid Bodies. (This creates keyframes). To remove shaky frames delete the shaky keys. and also running Curves > Simplify Curves might help (you can find that in the Graph Editor).

12. Repeat teh previous steps for the other debris. A good range for the inital settings is:

initialVelocityX : -5 to 5

initialVelocityY: 10 to 20

initialVelocityZ: 20 to 33

initialSpinX: -440 to 440

initialSpinY: -360 to 360

initialSpinZ: -200 to 200

The following MEL Script pretty much automates this tedious process (you still need to adjust the settings and bake the simulation).

string $sel[], $rbname, $atname;
int $numsel, $i, $num;
float $xvel, $yvel, $zvel, $xspin, $yspin, $zspin;

$sel = `ls -sl`;
$numsel = size($sel);
for( $i = 0; $i < $numsel; $i++ ) {
	$atname = $sel[$i] + ".translateX";
	$xvel = `getAttr $atname`;
	$yvel = rand(10,20);
	$zvel = rand(15,30);
	$num = $i + 1;
	$rbname = "rigidbody" + $num;
	select $sel[$i];
	rigidBody -n $rbname -l $num -sf 0.5 -df 0.5 -b 0.3
		-afa centerOfMass -iv $xvel $yvel $zvel;
	$xspin = rand(-440,440);
	$atname = $rbname + ".initialSpinX";
	setAttr $atname $xspin;
	$yspin = rand(-360,360);
	$atname = $rbname + ".initialSpinY";
	setAttr $atname $yspin;
	$zspin = rand(-200,200);
	$atname = $rbname + ".initialSpinZ";
	setAttr $atname $zspin;
	connectDynamic -f gravity1 -f drag1;
}

13. If some debris fall through the ground it’s usually because they are just flat faces. I would suggest extruding some faces to give them some volume before running the dynamic simulation

14. Now the flaming part! Pick all the debris and do Particles > Emit from Object with

Emitter type: surface

Rate: 500

Speed: 2.5

Speed random: 1

Tangent speed: 0.5

Normal speed: 0.5

A particle object will be created, name it debrisfire and set its attributes to

Lifespan mode: randowm

Lifespan: 0.2

Lifespan random: 0.1

Start frame : 10

Particle render type: multistreak

Add attribute for current render type:

Color accum: on

Line width: 2

Multi count: 20

Multi radius: 0.42

Tail fade: 0

Tail size: 3

Use lighting: off

Casts shadows: on

Primary visibility: on

Add Dynamic Attributes :

Color: add PP attr. and create a ramp like so (V ramp / exponential down)

In he color gain put 0.14/0.14/0.14

15. With the particle object still selected creaet Fields > Uniform (Magnitude = 8 MaxDistance=off direction 0-1-0 attenuation = 0). With the particle object selected create the following turbulence:

Field name: turbulence1

Magnitude: 15

Attenuation: 0

Frequency: 3

Phase: 0, 0, 0

Noise level: 1

Noise ratio: 0.6

Use max distance: off

16. Now let’s create the flash that occurs when the house blows up. First, in the preference dialog set the default in and out tangents to linear. Create a spot light and move it and orient it so that it points out of the gapin ghole in the house.

Intensity: 0

Color: 1, 0.95, 0.5

Cone angle: 110

Penumbra angle: 10

Dropoff: 0

Decay rate: none

Cast shadows: on

Shadow color: black

Depth map shadow (dmap) resolution: 512

Use mid dist dmap: off

Use dmap auto focus: off

Dmap focus: 120

Dmap filter size: 1

Dmap bias: 0.01

Fog shadow intensity: 1

Fog shadow samples: 30

Keyframe the created light’s intensity to 0 at frame 8, 1 at frames 10 and 13, and then back to 0 at frame 16. Back in the light’s attribute editor add some lightfor effect:

Color: white

Density: 1

Color based transparency: on

Fast drop off: on

Leave the other attributes at their default values

Fog spread: 1.1

Fog inensity: 1

17. For the sprks create a particle emitter with the following propertie and position it at (0, 3.7, 1.8) rotate it (-20, 0,0) and scale it to (4.5, 2, 0.1)

Emitter name: SparkEmitter

Emitter type: volume

Rate: animate from 0 at frame 9, to 1100 at frames 10 and 11, and back to 0 at frame 12

Direction: 0, 0, 1

Speed random: 6

Volume shape: cube

Volume offset: 0, 0, 0

Die on emission volume exit: off

Away from center: 4

Along axis: 0

Around axis: 0

Random direction: 8

Directional speed: 15

The attributes for the particles are:

Lifespan mode: random range

Lifespan: 0.7

Lifespan random: 0.5

Start frame: 10

Particle render type: tube

Click Add Attributes For Current Render Type

Radius0: 0.06

Radius1: 0.12

Tail size: 0.11

Casts shadows: off

Shift select the ground and the particles and choose Make Collide (Resilience: 0.5 Friction: 0.6) Connect the particles to Gravity1

Finally, in the hypershade create a particle cloud material and assign it to the particle. Settins are like:

Color (RGB): 1, 0.98, 0.8

Transparency (RGB): 0.1, 0.1, 0.1

Density: 1

Blob map: white

Roundness: 1

Translucence: 0.5

Noise: 0

Diffuse coeff: 0 y

18. No the fireburst (if you think it’s endless and tedious scroll below to see where we are going. I hear it’s common for effect animation to have so many elements. You can always use stock footage ifyou want). For the fireburst create another volume emitter (move it to (0, 3.8, 0) and scale it by (4.5, 2, 0.5) Keyframe the emission 0@10, 4000@11 and 14 and 0@15.:

Emitter name: fireburst

Emitter type: volume

Rate: 0

Direction: 0, 0, 1

Speed random: 30

Volume shape: cube

Away from center: 0

Along axis: 0

Around axis: 0

Random direction: 30

Directional speed: 70

Scale speed by size: off

Rename the particles fbparticles and assign them the following attributes (naming the particles correctly is crucial in order for you to follow how this is all composited later on).

Lifespan mode: random range

Lifespan: 0.45

Lifespan random: 0.2

Start frame: 10

Particle render type: cloud

Casts shadows: off

Go to the Add Dynamic Attributes section and click on the General button; in the invoked Add Attribute window, go to the Particle section and choose radiusPP. Back in the particle attribute editor, right-click on the radiusPP parameter field and choose Creation Expression. Type in the following expression:

seed(fbparticles.particleId + 415);

fbparticles.radiusPP = rand(1.4,2.4);

While the particle is still selected, run Fields ··> Drag (options)

Field name: drag2

Magnitude: 7

Attenuation: 0

Use direction: off

Use max distance: off

Select the particle again, and run Fields ··> Uniform (options)

Field name: uniform2

Magnitude: 46

Attenuation: 0

Direction: 0, 1, 0

Use max distance: off

Select the particle yet again, and run Fields ··> Turbulence (options)

Field name: turbulence2

Magnitude: 17

Attenuation: 0

Frequency: 0.5

Phase: 0, 0, 0 (we’re going to animate this)

Noise level: 1

Noise ratio: 0.65

Use max distance: off

Keyframe the new turbulence’s phaseZ to 0 at frame 1, and to 1.5 at frame 150.

19. To shade the fire create a Particle Cloud material with the following paratmeters:

Color: to be textured

Transparency: same

Density: 0.5

Blob map: white

Roundness: 0

Translucence: 0

Noise: 0.8

Noise freq: 0.15

Noise aspect: 0

Noise anim rate: 0.05

Solid core size: 0

Diffuse coeff: 1

Surface color (RGB): 0.3, 0.3, 0.3

Translucence coeff: 0

Surface shading shadow: off

For the color use a crater texture (with texture placement) that has

Shaker: 3

Channel1 (RGB): 1, 0.7, 0

Channel2 (RGB): 1, 0.3, 0

Channel3: black

Melt: 0

Balance: 0.6

Frequency: 2

Color gain (RGB): 1.4, 1.4, 1.4

Move the crater’s 3D texture placement node to (28.7, 0, 0) and scale it by (2.3, 2.3, 2.3). Keyframe its y translation to 0 at frame 1 and to 50 at frame 150; keyframe its z translation to 0 at frame 1 and to 60 at frame 150.

Back to the particle cloud material – click the map button next to the Life Transparency parameter and choose a ramp (with texture placement). Set up the ramp as follows (V ramp smooth interpolation)

Color gain (RGB): 1.4, 1.4, 1.4

The completed shading network should look like:

Assign it to the particles!

20. Now some smoke! Create another of those volume emitters:

Emitter name: smokeburst

Emitter type: volume

Rate: 600

Direction: 0, 0, 1

Speed random: 7

Volume shape: cube

Away from center: 0

Along axis: 0

Around axis: 0

Random direction: 7

Directional speed: 15

Scale speed by size: off

Rename the particle *shape* associated with this emitter to sbparticles and set its attributes to

Lifespan mode: random range

Lifespan: 3

Lifespan random: 1

Start frame: 12

Particle render type: cloud

Casts shadows: on

Add a radiusPP attribute like you did for fparticles and set its creation expression to

seed(sbparticles.particleId);

sbparticles.radiusPP = rand(1,2);

While the particle is still selected, run Fields ··> Drag (options)

Field name: drag3

Magnitude: 2

Attenuation: 0

Use direction: off

Use max distance: off

Select the particle again, and run Fields ··> Uniform (options)

Field name: uniform3

Magnitude: 15

Attenuation: 0

Direction: 0, 1, 0

Use max distance: off

Open the dynamic relationships editor and connect the particle to turbulence2.

21. Shading the smoke

Create yet another particle cloud material. Name it explosmoke. Map its life color and life transparency to two separate ramps. Set the other parameters as follow:

Density: 0.5

Blob map: white

Roundness: 0

Translucence: 0

Noise: 0.8

Noise freq: 0.15

Noise aspect: 0

Noise anim rate: 0.05

Solid core size: 0

Diffuse coeff: 1

Surface color (RGB): 0.9, 0.9, 0.9

Translucence coeff: 0.4

Surface shading shadow: on

Filter radius: 5

For the life color ramp we have a smooth v ramp as follows:

Color gain (RGB): 3, 3, 3

The crater mapped to the bottom color should be

Shaker: 2.5

Channel1 (RGB): 1, 0.55, 0

Channel2 (RGB): 1, 0, 0

Channel3: black

Melt: 0

Balance: 0.25

Frequency: 2

Furthermore, scale the crater’s 3D texture placement node by (1.5, 1.5, 1.5); keyframe its y translation to 0 at frame 1 and 23 at frame 150; keyframe its z translation to 0 at frame 1 and 26 at frame 150.

As for the life transparency (v ramp smooth) ramp, set it to

The complete shading network should look like:

21. Lighting the scene. We’re getting there! To simulate the illumincation from the fireburst create a point light with the following settings:

Light name: explolight

Color: set to the expression

explolight.colorR = noise(frame/3)*0.1+0.9;

explolight.colorG = noise(frame/3)*0.1*0.9;

explolight.colorB = 0;

Intensity: keyframed to 0 at frame 10, 6 at frames 13 and 19, and 0 at frame 25

Illuminates by default: off

Decay rate: linear

Use depth map shadows: on

Dmap resolutio: 512

Use dmap auto focus: off

Dmap focus: 90

Dmap filter size: 2

Dmap bias: 0.01

Use XYZ± dmap: all on except Z+ dmap

Name the light’s transform node Explolight; keyframe its y translation to 4 at frame 10 and 7 at frame 25; keyframe its z translation to 3 at frame 10 and 9 at frame 25. Leave its x translation at 0.

To simulate the illumination from the post-explosion fire, create a directional light with the following settings.

Light name: firelight

Color (RGB): 1, 0.6, 0

Intensity: set to the expression firelight.intensity = noise(frame/2)*0.1+0.6

Illuminates by default: on

Use ray trace shadows: on

Light angle: 0

Shadow rays: 1

Ray depth limit: 1

Name the light’s transform node Firelight and rotate it by (90, 0, 10).

Create another fire light that’s brighter and nearer to the house; make it a spot light this time with

Light name: strongfirelight

Color: to be mapped, described below

Intensity: animate from 0 at frame 11 to 1 at frame 17

Illuminates by default: off

Decay rate: no decay

Cone angle: 20

Penumbra angle: 10

Dropoff: 30

Use depth map shadows: on

Dmap resolution: 512

Use mid dist dmap: off

Use dmap auto focus: off

Dmap focus: 30

Dmap filter size: 2

Dmap bias: 0.13

Map the color parameter to a fractal texture with the following setting.

Amplitude: 1

Threshold: 0.2

Ratio: 0.3

Level min: 0

Level max: 4

Animated: on

Time: animated from 0 at frame 1 to 2.5 at frame 150

Color gain (RGB): 1, 0.5, 0

Invert: on

Go to the fractal’s place2dtexture node and set

Coverage: 8, 8

Translate frame u: -2.5

Translate frame v: animated from 0 at frame 1 to -3 at frame 150

Name the spot light’s transform node Strongfirelight, translate it to (-5, 25, 20), and rotate it by (-57, -20, 0).

Create one last light, a directional light this time with

Light name: keylight

Color (RGB): 0.73, 0.82, 1

Intensity: 0.8

Illuminates by default: on

Use depth map shadows: on

Dmap resolution: 1024

Use mid dist dmap: off

Use dmap auto focus: off

Dmap width focus: 60

Use light position: on

Dmap filter size: 2

Dmap bias: 0.13

Name this light’s transform node Keylight, translate it to (50, 30, 78) and rotate it by (-20, 40, 0).

Open Window ··> Relationship Editors ··> Light Linking ··> Light Centric. Link Explolight to only Ground, Base1, Cyls1 and the house. Link Strongfirelight to everything except the particles.

22. Rendering – Finally!

Rendering particles is never a straight-forward business in Maya (what is?). Take note of the following observations before we continue with the tutorial:

  • Particles can be hardware or software rendered (we’ll be using both methods here). Generally, hardware-rendered particles are more suitable for wispy stuff like fire or thin smoke, while software-rendered particles are more suitable for thick swelling stuff like fire ball or cloud. The images must be prepared carefully to allow for compositing later.
  • You must use raytracing to cast correct shadows from software-rendered particles.
  • Hardware-rendered particles don’t cast shadow.
  • Raytracing thick cloud illuminated by positional lights (point and spot lights) is very slow.
  • Tube particles appear tube-like only in motion-blurred rendering.
  • On the other hand, cloud particles exhibit horrible artifacts in motion-blurred rendering.
  • Raytraced particle shadow erases non-particle shadow when both are cast on the same spot!
  • All these problems can be solved by rendering in different layers and then compositing them together later.
  • The rendering steps below should be done in the order in which they are presented – it’s tedious…

LAYER 1 – background and LAYER 2 – mainshadow

Hide all lights except the keylight..Hide all debris.

Modify ··> Disable Nodes ··> Particles.

In the render globals, turn off raytracing and turn on 3D motion blur. Turn on Enable Global Passes (located under the Render Layer/Pass Control section) – turn off beauty pass, and turn on color and shadow passes.

After the rendering is done, rename the color pass to background.# (# is the frame number) and the shadow pass to mainshadow.#.

LAYER 3 – Firecloud

Make visible the firelight. Hide the ground. Turn on is dynamic for fbparticles and sbparticles (in channel box).Open the attribute editor for the material assigned to the house (should be lambert1) and set its matte opacity mode to black hole (if your house has been textured with more than one material do that for all of them). Open the attribute editor for keylight, and turn on use ray trace shadows (light angle = 0; shadow rays = 1; ray depth limit = 1). In the render globals, turn on raytracing, turn off motion blur, and turn off Enable Global Passes. Make the file name prefix firecloud.

LAYER 4 – Smoke’s Shadow

Make the ground visible. Turn off is dynamic for fbparticles. Turn off primary visibility (under the render stats section in the attribute editor) for sbparticles. Set the house material’s matte opacity mode to solid matte. In the render globals, turn on Enable Global Passes, and turn on only the shadow pass. Rename the rendered images to smokeshadow.#.

LAYER 5 – Flash

Make visible the debris. Modify ··> Disable Nodes ··> Particles. Hide all lights except the flash light. In the render globals, set the file name prefix to flash, turn off raytracing, turn on 3D motion blur, and turn off Enable Global Passes.

LAYER 6 – Flamelight

Hide the debris. Hide the flash light and make visible strongfirelight.In the render globals, set the file name prefix to flamelight.

LAYER 7- Explode Light

Hide strongfirelight and make visible explolight. In the render globals, set the file name prefix to explodelight.

LAYER 8 – Sparks

Hide explolight and make visible keylight. Turn on is dynamic in the spark particle. Set the house and ground material’s matte opacity mode to black hole. Set the render file name prefix to sparks.

LAYER 9 – Debris

Turn off is dynamic in the spark particle. Hide all objects except the debris and keylight.In keylight, turn on use depth map shadow. In the debris’ material, set matte opacity mode to solid matte. Set the render file name prefix to debris.

LAYER 10 – Debris shadow

Unhide all non-light objects. Pick all the debris objects, and open Window ··> General Editors ··> Attribute Spread Sheet; under the Render tab, turn the whole column of Primary Visibility off. In the render globals, turn on Enable Global Passes, and turn on only the shadow pass.

LAYER 11 – Debris fire

Turn on is dynamic in debrisfire.

Make sure your screen-saver is turned off. Run Rendering editors ··> Hardware Render Buffer. From the hardware render window’s menu, choose Render ··> Attributes and set

Filename: debrisfire

Alpha source: luminance

Line smoothing: on

Geometry mask: on

Multi pass rendering: on

Render passes: 7

Anti-alias polygons: on

Edge smoothing: 3

Motion blur: 0

File name extension, start frame, end frame, by frame, image format and resolution should be set to match your software rendering. From the same menu, choose Render ··> Test Render. Close and reopen the hardware render window, and then choose Render ··> Render Sequence. Rename the rendered images to debrishadow.#.

COMPOSITING

In Shake the orginal author built the following network:

I ended up tweaking some nodes so here’s the network I built (I used some over nodes instaead of some add nodes which could be due to the fact that I forgot to hide the buildin in some layers)

It evaluates from top to bottom and left to right. Voila!

in the news

Mapping Effects of Electroacupuncture Paves Way for Targeted Fibromyalgia Pain Treatment


By mapping the molecular effects of electroacupuncture in mice with fibromyalgia, a research team suggested that the molecule ASIC3 might be a suitable target for the development of treatments for pain sensitivity in fibromyalgia.

more...

herbe du jour

Dà Huáng / Rheum_palmatum


Purgative - Drains heat and purges accumulations and fire, dries damp, promotes urination, cools the blood, invigorates blood circulation and removes blood stasis, reduces fire toxins

more...

upcoming events

  • No Events Available
AEC v1.0.4