| Previous Topic (Particle Channels Editor Display Options) | Up (Particle Channels Editor) | Next Topic (Particle Channels Editor Performance) |
MagmaFlow Editor Examples
Available in Krakatoa v1.5.0 and higher
- 1 MagmaFlow Editor Examples
Basic Level Examples
Position To Color
- Feeding the Position Channel into the Color Channel.
- The Position values are multiplied by a Float to bring colors in the range of 0-1
Velocity To Color
Normal To Color
- Copying the Normals into the Color channel:
Color Blend By Normal Z
Position Push By Normal
- Taking the Position, adding the Normal multiplied by a Float 5.0 and outputting to the Position channel again pushes the particles along their normals:
Position Sine To Color
- Feeding the Position Channel into the Color Channel via a Sine Function.
- The Position values are multiplied by a Float which is animated, producing moving R,G,B color waves along local X, Y and Z.
Intermediate Level Examples
SinWave Push By Normal
- In this case, the Z Component of the Particle Position defines the value passed to the Sin function.
- One Float is used to multiply the component before it goes to the Sin function - this controls the Frequency
- Another float is added to the Z position before it goes to the Sin function - this controls the Phase.
- The result of the Sin function is then multiplied by a third Float which defines the Amplitude.
- The final value of the Sin function is used to scale the Normal vector which is then added to the Position
- The result is finally output to the Position channel, resulting in a Z-axis-aligned Sine wave pushing along the surface normals.
SinWave Color And Push By Normal
- In addition to the Sine Wave along the Normals, a second KCM was added to blend two colors based on the same wave:
Benchmarks:
- 50 Million Particles, SinWaveColor Flow Only, Single-Threaded: 12.644 seconds pure flow evaluation time
- 50 Million Particles, SinWaveColor Flow Only, Multi-Threaded: 5.687 seconds (2.22332x)
Color Blend By Velocity
Color Blend By Camera Distance
- Input Vector (8) is linked to the position track of the Camera.
- The Magnitude of the Distance from the Camera to the Particle is used to Blend between dark blue and white:
Color Blend By Gizmo
- The Input Vector (8) is linked to the position track of the Sphere Gizmo helper.
- The Input Float (9) is linked to the Radius track of the Sphere Gizmo helper.
- The Magnitude of the Distance from the Gizmo to the Particle is normalized by the Radius and clamped between 0 and 1, the fed into a Blend between the original particle Color channel (magenta) and Input Vector with yellow color.
- When the Clamp is set to 0 to 10, some of the RED in the original channel is removed when the position of the particle is outside the Gizmo radius, resulting in violet color:
Texture Blend By Gizmo
- Same as above, but using TextureMap Inputs instead of Vectors.
- The base texture is a Tile Map with a Checker Map in the one color slot.
- The gizmo texture is a Cellular in Chips mode.
Cellular Map Coloring And Normal Displacement
- This PRT Loader has two KCM flows applied:
- The first one takes a Cellular map and writes to the Color channel.
- The second one takes the Color channel, calculates its Magnitude and displaces particles along their Normals.
- This way, the map has to be evaluated just once and the Color Channel is passed up the stack to the second modifier.
Advanced Level Examples
Blinn Shading Using One Light
- This flow implements a simple Blinn Shading using a Camera and a Spot Light.
- The position of Camera and Light and the Color of the Light are linked to Vector Inputs resulting in interactive updates.
- The Glossiness, Shininess Strength and Object Color are exposed as Inputs.
Benchmarks:
- 1 Million Particles
- No KCM: 1.266 seconds.
- KCM Single-Threaded: 2.172 seconds, 0.906 seconds KCM = 1.10375 Megapoints per sec.
- KCM Multi-Threaded: 1.437 seconds, 0.171 seconds KCM (5.29825x faster) = 5.847 Megapoints per sec.
- 50 Million Particles:
- No KCM: 56.293 seconds.
- KCM Single-Threaded: 100.564 seconds, 44.271 seconds KCM = 1.12941 Megapoints per sec.
- KCM Multi-Threaded: 66.780 seconds, 10.487 seconds KCM (4.22151x faster) = 4.76781 Megapoints per sec.
Camera Projection Mapping
- This example shows how to generate Camera Mapping coordinates.
- Note that you can use the 3ds Max Camera Map Per Pixel to get the same result, so this is an academic example of what KCM is capable of.
- The first screenshot displays the flow which generates the UV Coordinates in TextureCoord channel.
- The Viewport screenshot shows a teapot with the same texture as the background applied using Mapping Channel 1.
- The other Viewport screenshot shows the same teapot without the background.