Culling Particles Using Selection Channel¶
Available in Krakatoa v1.5.1 and higher
Introduction¶
- Versions of Krakatoa prior to v1.5.0 allowed the culling of particles loaded by the PRT Loader object using geometry objects based on the location of the particle relative to the surface (inside or outside).
- Krakatoa v1.5.1 adds the ability to delete particles using a Krakatoa Delete modifier and the Selection channel which can be provided by the PRT sequence, the PRT Volume object’s geometry source or a Krakatoa Channels Modifier.
- By default, any particle with a positive Selection channel value will be deleted and not processed further.
- Optionally, the Soft-Selection values (between 0 and 1) and the ID channel or the Index channel can be used to delete particles gradually with varying probability.
Examples¶
Culling using KCM and Position Channel¶
- Starting with a simple Teapot converted to particles using a PRT Volume object.
- A Normal to Color channel KCM was used to display the particles in the color of their normal vectors.
- Using another KCM, we set the Selection channel based on the X component of the Position Vector - any particles with X less than Zero are set to Selected.
- A Krakatoa Delete Modifier on the stack above the KCM deletes the particles:
- The PRT Volume shows the result in the viewport
- Just changing the Integer Input from 1 to 2 (X to Y axis) produces culling along the Y axis, removing particles with Y less than Zero.
Culling using KCM and Normal Component¶
- Similarly, we can replace the Position channel with any other Channel and delete particles with a given color, Mapping Coordinate, Velocity etc.
- In the following example, we will delete particles based on a component of their Normal channel.
- Switching the Logical Operator from Greater to Less and the Float Input from 0 to 0.5 produces the following:
Culling using KCM and Texture Map¶
- Instead of using an existing channel, we can also replace the Input of the KCM with a TextureMap, thus culling based on the color of the map:
- The following example uses the default Cellular map and checks if the R component is less than 0.95:
- Switching the test to Greater than 0.25 produces the following result without changing the map:
Culling using KCM and Sphere Gizmo¶
- In the following flow, the Position of the particle is subtracted from the object space position of the SphereGizmo helper in the scene.
- If the Magnitude of the resulting vector which is equivalent to the distance between the particle and the center of the helper is less than the Radius of the Helper (represented by a Float Input connected to the Radius track of the gizmo), the Selection will be set to 1.
- Otherwise, particles outside the radius will have a selection of 0 and will thus not be deleted:
Culling using KCM, Sphere Gizmo and Soft-Selection¶
- In the following flow, the selection channel is set to a value varying between 0 at the surface of the Gizmo to 1 at 15 units inside the Gizmo.
- The Distance between the Particle and the Center of the Gizmo is calculated and subtracted from the Radius of the Gizmo.
- The value is clamped between 0 and 15 units - any particles that are farther than 15 units from the outside of the gizmo would produce a value of 15, any particles outside of the gizmo would produce a value of 0.
- The resulting value is then divided by the same 15 units (which is the band we want to define as semi-deleted) - the result is a value between 0 at the surface of the gizmo and 1 at 15 units inside the volume.
- This value is then tweaked by the Power of 0.05 to produce a more interesting falloff curve and that value is output to the Selection channel:
- The Krakatoa Delete Modifier was switched to use the Soft-Selection, producing a gradual fade off instead of a clear cut:
