Particle culling by velocity

Following my wishlist frost thread here: viewtopic.php?f=67&t=5104

Realizing it’s supposed to be quite easy to do in Krakatoa I gave it a go. Culling particles by an object is of course rather easy (using the culling rollout in the prt loader). Culling particles by velocity data is a different story. I managed to set magmaFlow to clamp and visualize the velocity I want to use, but how do I kill particles with it? I tried to use a selection output instead of color figuring I could add a krakatoa delete modifier on top of it, but it resulted in errors and didn’t work.

Eventually what I’m trying to do is to separate the red and blue particles so that I could generate different meshes from them using the same particle sequence.

Thanks!
binfile&Magmaflow.rar (3.15 MB)

In the spirit of the traditional 3ds Max workflow for this sort of thing, we have a Krakatoa Delete modifier that respects the “Selection” channel of the particles. Here’s some documentation on how you might use it: http://www.thinkboxsoftware.com/krak-culling-particles-using-s/. You can use the magnitude of the velocity to convert to a selection, then delete the selected particles. It even supports a soft selection delete where each particle is deleted once its selection weight crosses a per-particle random threshold.

This is best accomplished at the moment by duplicating your PRT Loader and inverting your selection weights (ie. 1 - Selection) on one of them so that the opposite particles are deleted in each.

It is quite simple - all you have to keep in mind is that the Max Selection channel contains a Float value and not a Vector. The Float value represents the Soft Selection, so a value of 0 means unselected, value of 1.0 means fully selected, and values between them mean partially selected.

Thus the Flow can look like this:

Velocity Input --> Magnitude Op --> LessThan Op (<-- Float Input) --> ToFloat Op --> Selection Output

So the Velocity’s Magnitude goes into a Logic LessThan operator and compares to the Float Input value. If the value is less than the Float Input value, the output of the Logical operator will be 1 (Integer), otherwise it will be 0. You convert that into a Float and output as Selection. This will give you a HARD selection (no Soft Selection values) and a Krakatoa Delete modifier will delete the slow particles and leave the fast ones. You can switch the LessThan to GreaterThan operator to invert the selection.

To do a Soft-Selection, you can use a slightly different flow:

Velocity Input --> Magnitude Op --> Divide Op (<-- Float Input) --> (Float 1.0–>) Subtract Op --> Selection Output

This takes the Magnitude, normalizes it by the max. Speed Float value (say, 123.4), subtracts from 1.0 and outputs the result into the Selection channel. If the Speed is 0.0, the output will be 1.0. If the Speed is 123.4, the output will be 0.0. Higher speed will produce values below 0.0, but the Krakatoa Delete won’t mind. You can clamp the division result between 0 and 1 if you want. As result, the slow particles will be deleted, the fast ones kept. To keep the slow ones, skip the subtraction from 1.0 part.

If you use Soft Selection, you can also switch the Krakatoa Delete modifier to use it (it requires a valid ID channel though to be consistent). As result, semi-selected particles will be deleted with different probability, producing a nice falloff gradient, but you don’t want that for your separation task, so the first example of Hard selection should be what you want.

Thank you both, its working great! :slight_smile: