Previous Topic (Mixing Additive And Volumetric Shading) Up (Tutorials) Next Topic (Clouds Modeling Workflow)

Creating Thick Smoke Using Particle Flow, Mesher and PRT Volume in Krakatoa v1.5.0


Introduction

  • The following tutorial demonstrates how to convert a small amount of particles with geometry shapes into a dense particle cloud approximating the Afterburn smoke look.

The Idea

  • The PRT Volume object introduced in Krakatoa v1.5.0 can be used to convert any geometry volume into a particle cloud.
  • While the Particle Flow itself cannot be used directly with a PRT Volume modifier, a Mesher Compound Object capturing the geometry of the flow can be accepted by a PRT Volume.
  • Instead of simulating millions of particles which can be relatively slow, we will use only 10,000 particles emitted over 200 frames.
  • Each particle will be assigned a Geosphere geometry object using a Shape Instance operator.
  • The scale of the shapes will be changed over the life of the particle
  • The Vertex Colors of the particle itself will be set to fall off exponentially over the life of the particle - this can be done either using a Box #3 DataOperator or via a Script Operator.
  • The animation of the particles will be driven mainly by a turbulent wind.

Creating the Basic Particle Flow

  • Open Particle View
  • Create a Standard Flow.
  • Change the emitter icon size to 5x5 units.
  • Set the Viewport % to 100.0
  • Set the Birth Operator to emit 10,000 particles from frame 0 to 200.
  • Change the Speed Operator to Speed 10.0, Variation 5.0, Divergence 60.0.
  • Add a Force Operator.
    • Create a Wind Space Warp pointing up in the scene, set Strength 0.4, Turbulence 1.0, Frequency 0.5, Scale 0.1.
    • Create a Drag Space Warp with Time Off 1000 and Linear Damping of 5.0 along all 3 axes.
    • Add both Space Warps to the Force Operator.
  • Replace the Shape Operator with a Shape Instance.
    • Create a Geosphere primitive in the scene.
    • Set Radius 5.0, Segments 2, Type Octa.
    • Pick the Geosphere as the Shape
  • Add a Scale Operator to the flow.
    • On frame 0, set the Scale Factor X,Y and Z% to 50.0
    • Enable Auto Key, go to frame 60 and set the Scale Factor to 500.0
    • Disable Auto Key and set the Scale Variation to 100.0% of all 3 axes.
    • Set the Bias to Centered
    • Set the Sync By to Particle Age
  • Add a Spin Operator, set to Spin Rate 180.0 and Variation 360.0, Random 3D.
  • Add a Delete Operator and set to By Particle Age, Life Span 70, Variation 5.
  • Set the Display Operator to Geometry.
  • Right-click the PF_Source event, select Properties and uncheck the "Renderable" checkbox.

We will deal with the DataOperator/Script Operator performing the particle density fade off a bit later.

Creating the Mesher

  • Go to the Create tab, Geometry, Compound Objects drop-down list item and click the Mesher object.
  • Create a Mesher object in the scene.
  • Go to the Modify tab, pick the PF Source emitter as the object to mesh.
  • Move the Mesher to [0,0,0] to make it match the location of the Particle Flow.
  • Create a PRT Volume object and pick the Mesher as the source object.
  • Set to Grid Spacing to 1.0.
  • Open the Material Editor and assign a Standard Material to the Mesher.
  • Add a Noise Map to the Opacity Map slot of the material.
    • Set the Noise to Explicit Map Channel 1, Fractal, Size 0.5, High 0.55, Low 0.35

At this point, the Mesher will have a texture map which sticks to the UVW Channel 1 of the instanced Geosphere shape. The PRT Volume will acquire the UVW Channel and also propagate the values through the volume of each sphere. This will change the density of the particles created inside the volumes of the spheres as long as the >Scale Density Using Material Opacity option is checked in the Krakatoa Main Controls rollout!

Creating Scene Lighting

  • Create a Spotlight with a yellowish tint to illuminate the particle cloud from the one side.
  • Create another Spotlight with a blueish tint and a Multiplier of 0.3 to illuminate the particle cloud from the other side.
  • Feel free to tweak the lighting to your liking. Remember that you need at least one light to render the particles as voxels!

The image shows the Particle Flow in the viewport on frame 60. It contains 3000 spheres

Rendering In Krakatoa

  • Open the Krakatoa GUI.
  • In the Main Controls rollout,
    • Check >Use Scene Lighting
    • Switch to Voxel Rendering, Volumetric Density, Isotropic, Voxel Size 1.0, Voxel Filter Radius 2.
    • Set Density Per Particle to 1.5/-1
    • Enable >Use Lighting Pass Density Settings and set Lighting Density Per Particle to 2.0/-1
    • Make sure both >Scale Density Using Material Opacity and >PRT Volumes are checked.

The image shows frame 60 containing 5.5M particles rendered as voxels

Density Falloff Using Box#3 Data Operator

The above rendering has a little problem - as the sphere particles get larger and older, they create more and more particles which means that the density of the smoke is actually increasing over time. This is unrealistic - as the smoke column gets wider over time, the density of the cloud should get lower as the particles drift away from each other. In addition, once the Delete operator kicks in, the large particles will pop out of existence abruptly. Even if this happens outside of the camera view, this might become apparent in the shadows in the visible part of the cloud.

To solve this, we will scale the density of the particles over the particle life so that it will be 0 when the particle dies.

  • Add a Data Operator to the Particle Flow.
  • Edit the Data Operator
  • Add an Input Standard SubOp and set to Time:Particle Age
  • Add a second Input Standard SubOp and set to Time:Lifespan
  • Add a Function SubOp and set to Real, Division
  • Connect both Input Standard SubOps to the two R inputs of the Fnction.
    • The automatically inserted Time-->Real Convert SubOps should be set to Frame.
  • Add another Function SubOp and wire it to the previous function.
    • Set the Type to Real
    • Uncheck Use Second Operand
    • Select Decimal Logarithm log10(X) as the function
    • Enter Post Factor -1.0
  • Add an Output Standard SubOp and set it to Vertex Color Channel
  • Wire the Function's output to the Output Standard's input.
    • Wire the Function to the other two inputs of the automatically inserted Real-->Vector Convert SubOp.


As result, the Vertex Color Channel of each particle will change from indeterminate when age is 0 to 0.0 at age equal to the Lifespan. Particles with age greater than 0 but less than 1 frame will have very high density, but then fall off exponentially over the lifespan.

Using Script Operator As Alternative To The Box #3 Data Operator

  • You can use a Script Operator with the following code to achieve the same Exponential Density Falloff effect.
  • Since we are using only 10,000 particles for the whole animation, the performance difference is negligible.
on ChannelsUsed pCont do
(
	 pCont.useMapping = true
	 pCont.useAge = true
	 pCont.useLifespan = true
)

on Init pCont do ()

on Proceed pCont do 
(
	count = pCont.NumParticles()
	for i in 1 to count do
	(
		pCont.particleIndex = i
		local theVal = -(log (pCont.particleAge.frame /  pCont.particleLifespan.frame))
		pCont.setParticleMapping i 0 [theVal,theVal,theVal]
	)
)

on Release pCont do ()

Controlling Density Via Vertex Color Channel

Now that we have the Vertex Color Channel containing an exponential value over the life of the particles, we can add its influence to the rendering:

  • In the Material Editor, add an RGB Multiply map to the Opacity Map slot, keeping the existing Noise as Sub-Map.
  • In the second slot of the RGB Multiply, add a Vertex Color Map and set it channel 0.

Render in Krakatoa - the Vertex Color channel will propagate into the particle shapes and into the Mesher and will be acquired by the PRT Volume. The particles generated in the volume will also acquire the Vertex Color channel and their density will be multiplied by both the Noise Map and the Vertex Color Map.


The image shows frame 60 rendered with Exponential Density Falloff

Resulting Animation

  • The following Quicktime Movie (800KB) shows the resulting animation, composited over a blueish background in post.