| Previous Topic (Using Krakatoa Particle Flow File Operators) | Up (Contents) | Next Topic (Using Krakatoa Geometry Test Operator) |
Blending Particle File Sequences Using Krakatoa Particle Flow Operators
Introduction
The Krakatoa File Birth and File Update Operators can be used not only to reload a single file sequence of PRT, BIN or CSV files back into Particle Flow, but also to create completely new particle systems by blending values from the various channels of one or more particle sequences.
The following tutorial will illustrate the basics of these blending features.
Creating Source Particle Sequences
Let's create a simple scene for testing.
- Create a Teapot.
- Create a Particle Flow source.
- Open Particle View.
- Set Quantity Multiplier > Viewport to 100%
- Set the System Management > Integration Step > Viewport to Half Frame.
- Set Birth to emit 20000 particles from frame 0 to frame 50.
- Replace the Position Operator with Position Object and pick the Teapot.
- Replace the Speed Operator with Speed By Surface with value of 30 and Divergence of 30 degrees.
- Remove the Rotation and Shape operators.
- Add a Force Operator.
- Create a Gravity Force Space Warp in the scene, set Strength to 0.26 and pick it in the Force Operator.
- Add a Cache operator to the Global Event of the PF Source.
At this point, we have a "waterfall" of particles streaming off the teapot and falling down under the influence of the Gravity.
Saving the Particle Sequence
Let's save the particles to a PRT file sequence.
- Click the Krakatoa GUI Icon on the Krakatoa toolbar or use the Assign Renderer rollout in the Render Scene Dialog to set Krakatoa as the current renderer and open the GUI. If using the icon and prompted about loading the last settings, answer No to load with Default settings.
- Switch the Particle Render Mode to "Save Particles To File Sequence".
- Open the Save Particles rollout and specify an output path for the sequence, for example "c:\temp\Krakatoa\PFoperators_Blending\Gravity\gravity_.prt"
- Leave all settings in the Channels rollout at defaults. The most important channels to save are Position, Velocity and ID.
- Right-click the SAVE PARTICLES button and select Active Segment [0-100]
- Press the SAVE PARTICLES button to save the particle sequence to disk.
Creating a Second Particle Sequence
Let's save another file sequence, but this time without Gravity but with a turbulent Wind force instead.
- Create a Wind Force with Turbulence of 0.1, Frequency of 0.01 and Scale of 0.01.
- Remove the Gravity from the Force operator.
- Add the Wind Force to the Force operator.
At this point, the particles are flying in all directions from the emitter, affected by the turbulent Wind.
- Repeat the steps described using "Saving the Particle Sequence", but use "Turbulence" instead of "Gravity" for the Sequence name and particle file name.
Loading the Gravity Sequence
Now let's load the Gravity file sequence back into a new Particle Flow.
- Disable the first Particle Flow used to generate the sequences.
- Create a new Standard Flow
- Replace the Birth operator with Krakatoa File Birth.
- Load the "gravity_.prt" file sequence saved previously in the Birth operator.
- Replace the Position Icon operator with a Krakatoa File Update operator.
- Load the same "gravity_.prt" file sequence in the Krakatoa File Update.
At this point, the sequence should look almost like the original gravity-driven flow. The main difference is that the particles were saved in Render mode, thus the count is 100% and the integration was performed at Half Frame step.
- Select the Krakatoa File Update and press the Channel Setup button.
- By default, the Position and ID channels are the only ones checked. This means that the particle will be loaded with absolute positions but without any Velocity data, making the system "rigid" - applying any forces or other speed-related operators would not work because the positions are determined by the particle file sequence on each frame.
- To be able to perform any blending of velocities, we have to uncheck the Position channel and enable the Velocity channel. Notice that the appearance of the particle system does NOT change - instead of loading absolute positions, we now load the relative velocities leading to those positions. The positions are loaded by the Krakatoa File Birth only on the frame of birth of each particle!
- Note that the Blend Mode of the Velocity channel is set to Blend and Amount of 100.0 - this means "Load 100% of the channel value and mix it with 0% of the existing data in the Velocity channel" or in other words, "Replace the Velocity Channel Data".
- Let's change this by entering 10.0 in the Amount spinner. This means that 10% of the file Velocity channel will be mixed with 90% of the existing value in the channel. Since the velocities on the previous frame are rather similar, the difference in the final result is not big, but it is still visible.
- Switch the Blend Mode to "Add" and change the Amount to 1.0. Now, only 1 percent of the file Velocity channel will be added to the content of the Particle Flow Velocity channel without reducing it - thus, the Velocity accumulates over time.
- Switch the Amount to 100.0. Now, the whole 100.0 percent of the file Velocity channel are added to the content of the Particle Flow Velocity channel without reducing it - as result, the Velocity accumulates a lot over time.
Blending Velocities From Two Particle Sequences
Now that we know how a single sequence can blend its Velocities with itself, let's mix the Gravity with some Turbulence.
- Switch the Blend Mode of the Velocity channel to Blend and make sure the Amount spinner is set to 100.0.
- Add a new Krakatoa File Update after the first one and pick the file sequence "turbulence_.prt".
- Press the Channel Setup button, turn off the Position channel and check the Velocity channel.
At this point, since both operators are set to 100% Blend mode, the second operator will OVERWRITE the data in the Velocity channel and will completely kill the Gravity effect:
- Let's change the Amount to 50.0 - now, the Gravity will be loaded first, then 50% of the loaded Gravity will be mixed with 50% of the Turbulence from the second operator.
- Now let's change the Blend Mode to "Add" and set the Amount to 100.0 - this means that the velocity from the Gravity sequence will be loaded 100% first overwriting any velocity from previous frames, then the Turbulence file sequence's Velocity will be ADDED to that value on each frame, resulting in both velocities used fully at the same time.
- Switching the order of the Operators may or may not affect the result depending on the Blend modes. For example, if you load the Turbulence with 100% Blend and then Add 100% Gravity on top, the result will be identical to the previous example because A+B = B+A.
- But if you are mixing lower Amounts of forces, changing the order can lead to different results. For example, move the Turbulence to load first with 100% Blend, but then ADD only 50% of the Gravity to it to create a slight downward motion while preserving all of the turbulent behavior:
Blending Velocity From A Particle Sequence With Force Operators
Similarly to blending values from two or more file sequences, we can add regular Force operators to the particles, assuming the Blend mode is not set to Blend 100% which would override the Force values on each frame.
- Disable the Krakatoa File Update operator which loads the Gravity sequence.
- Set the Krakatoa File Update operator loading the Turbulence sequence to Amount of 50.0 and Blend mode.
- Add a Force operator after it and increase the influence to 10000 (because 50% of the resulting velocity will be removed by the Krakatoa File Update on each frame, the Gravity force requires a significant boost to accumulate enough velocity during the sequence)
- Switching the order - Force first, Turbulent sequence second - leads to a different result:
- Same applies to the Collision Test which, when used in Bounce mode, also modifies the Velocities of the particles.
- In the following example, the Turbulence is loaded in Blend mode with Amount of 50.0 and the Gravity is Added with amount of 50.0.
- The Collision operator is placed after the two Krakatoa File Update operators to prevent the particles from entering the spherical deflector.