Magma switch and optimization

Hi,

I have a question about the switch node in magmaflow.
Will it process all of the operations that go into both of the inputs regardless of which boolean state is active?

For example, let’s say I want to add position noise to 5% of the particles in my cache. The rest can have their original position passed through if they fail the boolean test. Will it evaluate the boolean condition first and skip the noise processing for the 95% that don’t need it, or will it run the noise first and then toss the data out once it hits the switch?

cheers,
CZ

My understanding is that currently there is no optimization going on whatsoever.
I also set up a test which shows that the time to execute the Magma is the same when the Switch is always true (passing a static vector to the Output Color), when it is 50/50 true and false (looking up a Normal channel from a mesh for the False value), and when it is always false. Only disconnecting the NearestPoint from the flow and passing the same static value for true and false reduced the processing time by 5 seconds for 4 million particles.

I am sure Darcy could provide a more in-depth explanation why it does not optimize yet (this has been asked before, of course). I believe there were technical reasons for it.

Thanks for the quick reply Bobo…this definitely helps me plan things out.

It would have been nice to condense several things down into one cache, but it looks like a tradeoff if I want to keep things flexible for magma adjustments. I can always split my special case particles into a separate loader or bake in their changes at a different step.

much appreciated,
Christian

I’ve had to make many variations on magmaflows because of this. I can’t just have options that I turn on and off, I have to just have many variations of the flow saved out and load the exact one I need. Otherwise I feel bad when I end up wasting so many hundreds of billions of clock cycles.

  • Chad