Controlling Geometry Animation
- Creating a Test Scene
- Tweaking The Distribution
- Look At Animation
- Keyframing The Window's Open Property
- Offsetting The Animation
- Stopping Time Flow
- Switching To PRT Loader Source
- Controlling Time Offset Explicitly
- Inverting the Animation
- Specifying Absolute Time Via GeomTime Channel
- Fading Texture Map Animation In And Out
- Animating Particle Radius By Texture Map
- Animating Particle Data Before Meshing
In the previous tutorial, we explored some of the Geometry Meshing options including control over Orientation, Shape and Material.
In the following exercise, we will look at the ability of FROST to accept and modify the mesh animation of the Custom Geometry objects, as well as some more advanced methods to control animation thanks to the tight integration of FROST with Krakatoa.
FROST can be used effectively with the free Evaluation Version of Krakatoa, so no additional costs arise from this approach!
Creating A Test Scene
- Create a Sphere primitive with Radius 50.0 and 16 Segments.
- Add a Mesh Select modifier and select the top and bottom pole vertices.
- Add a Delete Mesh modifier to delete these vertices.
- Create a Pivoted Window primitive with Width and Height of 20.0 and Depth of 5.0
- Create a FROST object, set Radius to 1.0
- Pick the Sphere as the Particle Object.
- Switch to Geometry Meshing Mode
- Switch the Particle Geometry to Custom Geometry and pick the Window.
- Select Orientation > Use Vector Channel > Normal
- Assign a Multi/Sub-Object Material to both the Window and the FROST objects.
- Set the Multi/Sub-Object Material to 5 sub-materials and set their Diffuse colors to red, yellow, cyan, blue and green colors.
- Set the third sub-material to 50.0% Opacity to make the glass transparent.
RESULT: We get a sphere made of windows.
Unfortunately, since the pivot point of the Window is at its base, our particles are not centered at the vertices of the distribution object, but offset up.
Let's fix this.
Tweaking The Distribution
- Add an XForm modifier to the Window primitive
- Go to Gizmo sub-object level
- Left-Click the Move icon in the Main Toolbar of 3ds Max.
- Right-click the Move icon to open the Transform Type-In dialog and enter -10 in the Z field of Offset:World.
- Hide the distribution Sphere object.
RESULT: The windows are now centered at the vetrices of the distribution Sphere.
Look At Animation
As we saw in the previous tutorial, the Orientation of the particles can be controlled using a dedicated Look At object. This is typically used to orient particles to the Camera, but as mentioned already, any scene object could be used as a Look At target, and the position of the object could be keyframed over time to produce animation of the dynamic orientation!
While we are not going to discuss this in detail in this tutorial, he is a quick example of a Point Helper selected as the Look At target and moved dynamically in the viewport to whet your appetite:
Keyframing The Window's Open Property
Let's animate the Open property of the Window primitive over time to see how FROST will deal with incoming geometry object animation.
- Move the Time Slider to Frame 30.
- Enable AutoKey and change the Open % spinner to 100.0
- Disable AutoKey.
- Move the Time Slider or play back the animatio...
RESULT: The windows will all turn 180 degrees from frame 0 to frame 30.
Offsetting The Animation
In the previous example, the FROST object used the default animation settings - Use Current Time and No Time Offset. The former causes the animation of the source geometry to be taken from the current time, and the latter means it will be applied to the current time, too.
- Select the FROST object
- Change the No Time Offset option to Random Offset By ID.
- Enter 30.0 in the Max. Offset field.
- Select the Window primitive and shift its keyframes to the right by 30 frames (from 30 to 60).
- Play back the animation.
RESULT: The animation of the Windows particles will be offset randomly by up to 30 frames to the left (in other words, it will start up to 30 frames earlier).
Stopping Time Flow
FROST uses the scene time flow when the Animation Timing is set to the Use Current Time option. Switching it to the Use Time 0 option will stop the time flow and make the Offset mode absolute instead of relative to the current time.
- Select the FROST object
- Switch the Use Current Time option to Use Time 0.
- Since the Open % animation of the Window primitive was shifted to 30-60 and the maximum offset specified is currently 30, the time 0 has the Window completely closed. Change the Max. Offset to 60.
RESULT: This will generate random offset values beyond frame 0 (between -30 and 30), producing a static look over all frames since the time flow was stopped from advancing, and each particles will use the shape's look on frame 0.
Changing the Random Seed below the Max. Offset value will change the random pattern.
Note that since vertices have no ID channel, their Index (order within the mesh) is being used. Should the topology change, the distribution would also change!
Switching To PRT Loader Source
So far we used the native data channels of the Sphere's vertices like Position, Normal and Index. In the current version of FROST, there is no way to apply channel modifiers to the geometry object directly. But as we saw in the previous tutorial, we could save the vertices to a PRT file on disk and apply Krakatoa Channels Modifiers (KCMs) to the PRT Loader instead for advanced particle control...
- Unhide the source Sphere
- Select the Sphere and Isolate it (Alt+Q)
- Assign Krakatoa as the current renderer.
- Switch to Save Particles To File Sequence mode.
- Enable >Geo.Vertices source option
- Specify a PRT file name to save to.
- Keep the default Channels to save (Position and Normal are the only ones we really need though)
- Press the SAVE PARTICLES button.
- Un-isolate and hide the Sphere again.
- Create a PRT Loader at the world origin and pick the saved file.
- Check Load Single Frame Only to load the same PRT file on all frames.
- Select the FROST object, remove the Sphere from the Particle Sources list and add the PRT Loader instead.
RESULT: The resulting FROST object should appear exactly like when the Sphere was used.
Controlling Time Offset Explicitly
Now that we have a PRT file as our particle source, we can introduce new Channels supported by FROST to control various aspects of the resulting animation.
For example, the channel GeomTime can be used to specify the Time Offset instead of generating a random one.
- Select the PRT Loader. (If FROST is selected, select the PRT Loader entry on the Particle Objects list, click the [>>] button and use Select Highlighted In The Scene to switch the Modifier Stack to the PRT Loader.)
- Add a MagmaModifier to the stack of the PRT Loader, open the Magma Editor.
- Press [Ctrl]+[O] to create a new Output node and select GeomTime from the list.
- Select the Output node and press [I] for Input, [C] for Channel and and select "Index" from the menu.
- With the InputChannel node selected, hit the [-] key on the numeric keypad to create a Subtract operator.
- With the Subtract operator selected, press the  key on the top keys row to add an Integer InputValue with value of 1.
- Enter 112 in the Input's Value field.
- Select the Subtract node and press [C] for Convert and [F] for ToFloat to convert the integer value to Float, since the GeomTime channel is expected as a Float value.
- Close the Magma Editor.
- Select the Window primitive and slide its animation keys range back to 0-30.
- Select the FROST object and switch from Random Offset by ID to Add GeomTime Channel.
- Switch from Use Time 0 to Use Current Time.
- Increase the length of the scene time segment to 150 frames and play back.
RESULT: The animation of the opening windows will be played back with a shift of 1 frame between every two particles from bottom to top.
The PRT Loader has 112 particles. The Vertex Index order is from top to bottom, starting with 1 and ending with 112. The time offset is thus specified as a negative value because we are subtracting 112 from the Index.
For example, vertex 112 will have an offset of 112-112=0, thus the bottom-most particle will play back the opening animation from 0 to 30 as the scene time advances.
The Vertex 1 on the other hand will have a timing of 1-112 = -111 and will thus play back its animation 111 frames later, from frame 111 to frame 141.
Inverting the Animation
In order to play back the animation in the opposite direction, from top to bottom, all we have to do is invert the Index value in the KCM:
- Select the PRT Loader.
- Open the Magma Editor.
- Select the Subtract operator and press Ctrl+W to swap the order of the input connections.
- Select the InputValue node and change the value from 112 to 0.
- Close the Magma Editor and play back the animation.
RESULT: The animation plays back in the opposite direction, top to bottom.
This is because we are subtracting the Integer from 0, so Vertex 1 produces an offset of -1 and vertex 112 produces an offset of -112.
Alternatively, we could use the Negate operator from the Arithmetic category to do the same, but we had the subtraction already wired and only had to change the order of operands.
Specifying Absolute Time Via GeomTime Channel
In the above examples, we let the time flow with the scene time. In other words, the GeomTime channel specifies the relative offset.
If we would switch the Time mode to Use Time 0, we will stop the scene time flow and the GeomTime will become absolute!
- Select the PRT Loader, open the MagmaFlow Editor.
- Select the Output node and change its type to Float16 - the GeomTime Channel is supported as both Integer and Float.
- Select all other nodes and press Delete or Backspace to remove.
- Drag a new TextMap input node from the Inputs category, connect to the Output node.
- Change the Texture Output Type to Mono (Float).
- With the TextMap input node selected, press * on the numeric keypad to add a Multiply operator.
- With the Multiply operator selected, press Ctrl+1 to create a new Float Input node.
- Change the Float input node's Value to 30.0 (the lenght of the animation range of the Window)
- Click the Get Texture Map... button and select a new Cellular map.
- Open the (Compact) Material Editor and select an empty slot.
- Press the Put to Active MEdtitor Slot button.
- Change the top Division color to black.
- Change the Size to 1.0
- Go to Frame 150, enable AutoKey and change the Offset: X value to 1.0
- Close the MagmaFlow Editor and play back the animation.
RESULT: The animation of the particles is now based on the 3D map's color.
White pixels produce a time value of 30.0, black pixels produce a time of 0.0, gray values something in between.
Since the Offset of the Cellular map is animated, the colors are shifting through space along the X axis and cause the time of each particle to change as its corresponding texel is changing color...
Fading Texture Map Animation In And Out
In the above example, the animaton of all windows was already in progress from the very beginning. What if we wanted to gradually fade in and out of the texture map-controlled animation?
- Select the PRT Loader, open the MagmaFlow Editor.
- Select the Float input used to multiply by 30.0 and change its Value to 0.0.
- Go to frame 50, enable AutoKey and change the Value to 30.0 again.
- Go to frame 100 and SHIFT+Right-Click the Arrows of the value spinner to set another key with Value of 30.0 on that frame.
- Go to frame 150 and enter a Value of 0.
- Disable AutoKey mode and play back the animation.
RESULT: The texture animation will fade in from frame 0 to 50, play until frame 100 in full force and fade out again from 100 to 150.
You can press the Zoom In Track View button of the Float input node in MagmaFlow to open the Track View at the node's animation controls and edit the bezier curve manually for more interesting results.
Animating Particle Radius By Texture Map
In addition to controlling the animation playback of the Custom Geometry objects, we can also animate various parameters of the FROST system itself, as long as they support a dedicated particle data channel. For example, the Radius property of FROST can be controlled by a Radius particle data channel which we could create using a Krakatoa Channels Modifier based on other particle channels, texture maps, surface data from other geometry objects and so on.
- Turn off the previous animation by switching Animation Timing to Use Time 0 and No Time Offset.
- Select the PRT Loader object and add a new Krakatoa Channels Modifier to the stack.
- Open the MagmaFlow Editor.
- Select the Output node and enter Radius as the Channel Name, set the Type to float16 and Arity to 1.
- Select the Input node, switch to TextureMap.
- Switch the output type to Mono (Float).
- Get an instance of the existing Cellular map from the scene.
- Close the MagmaFlow Editor.
- Select the FROST object and check Use Radius Channel.
RESULT: The Radius of the particles will now pulsate according to the grayscale color of the Cellular map.
Animating Particle Data Before Meshing
Because we have full access to all particle data channels coming in from the PRT Loader, we are free to modify them using Magma Modifiers even before they reach FROST. For example, having Position and Normal channels means we can modify the particle Positions by moving them along the Normals based on a texture map or another factor. Let's do that using the same texture map we applied to the Radius channel:
- Select the PRT Loader and add a new MagmaModifier to the stack.
- Press [Ctrl]+[O] to create an Output node and set it to Position channel.
- Select the Output node and press [SHIFT]+[P] to create an InputChannel node set to Position.
- With the InputChannel node selected, press the [+] key on the numeric keypad to create an Addition operator.
- With the Addition node selected, press [SHIFT]+[N] to add a Normal channel input.
- With the Normal channel input selected, press the [*] key on the numeric keypad to add a Multiply operator.
- Press [I] then [T] to create an InputTexmap node, switch the Output Type to Mono and get the existing Cellular map from the scene.
- Connect the InputTexmap to the second socket of the Multiply operator.
- With the InputTexmap node selected, press the [*] key on the numeric keypad to add another Multiply operator.
- With the Multiply operator selected, press [Ctrl]+ to create a Float inputValue with value of 1.0. Change the value to 20.0.
- Select the Multiply operator again and press the [-] key on the numeric keypad to insert a Subtract operator before the Multiply operator.
- Select the Float inputValue with value 20.0, press the Insert key (the Editor's title bar will change from INSERT 1 to CONNECT 1) and hit the [/] key on the numeric keypad to add a Divide operator without inserting it into the existing connection to the Multiply node.
- With the Divide node selected, press [Ctrl]+ to connect a Float InputValue with value of 2.0.
- Manually drag a connection from the Divide operator's output socket to the Subtract's second socket.
RESULT: The particles will now move between -10.0 and +10.0 units along the Normal depending on the color of the texture map. Changing the Float value from 20.0 to something else will change the range of motion. Since the previous KCM is still active and uses the same map, the Radius will also change in-sync with the pulsating particles.
Of course, the more general animation of Radius, Position etc. is not limited to Geometry meshing mode. Here is the same animation as above, but using Metaballs:
The Metaballs radius was increased to 30 because the incoming Radius by Texture was in the range betwee 0 and 1. The Meshing was set to Absolute and 1.0 unit sampling.
Another MagmaModifier was added BELOW the Push By Normal one to blend two custom colors - red and blue - based on the Texture Map's 0 to 1 Mono output. The Object Properties of FROST were set to display Vertex Colors. (adding the Color Blend KCM above the pushing one would have caused problems because the evaluation of the texture map depends on the particle positions, and the control values would have changed!)
In this totorial, we looked at the various controls over the animation playback of the Custom Geometry objects used to replace the particles inside the FROST mesh. Using the simple controls in the FROST UI and the advanced channel-based controls of Krakatoa, you can provide both relative and absolute timing information and produce complex effects in history-independent manner.
With the ability of the Krakatoa Channels Modifiers to modify existing and create new particle data channels, as well as read texture data, surface properties of scene geometry objects and perform various mathematical operations, the number of effects you could achieve is quite impressive.
In the next tutorial, we will see how FROST could improve the typical Krakatoa workflow by allowing you to increase particle counts and create some advanced rendering effects...