Turning instances on and off?

I am trying to do sort of an abstract virus simulation to illustrate the idea of exponential growth. So I have a noisy grid of host cells more or less suggesting skin and another noisy grid of virus pieces moving near surface. See pix. I was thinking of using a cone light that expands with a ramp but it is not looking so good. See code. Is there an easy way to kind of turn on and off individual instances with one user control ideally?

Virus.18.toe (14.0 KB)

Hi @gordharris,

when instancing you now have the possibility to use the active parameter that is above the transform on the Instance1 page. The channel referenced, will determine which instance is drawn (<=0 → don’t show, >0 → show).

For the active channel I’m using a Pulse CHOP with a single pulse and a Shift CHOP to Scroll Offset that pulse. The result is that I can control how many of the spheres are drawn. By default it would now draw the points in the order they are created in the Grid SOP. This might not be the way you like, so I added another branch where I reorder (via the Sort SOP) the points based on proximity to a position.
The reordered point numbers (I added an attribute to the SOP via the Point SOP) can now be retrieved and used to reorder the original points to also be sorted in the same order.
Just to try it out, I added a Filter CHOP with the option to Filter Per Sample enabled. This is used as the active channel but also as the alpha for your spheres and now you can also fade them in and out a little.

You can play with the different Sort types to see the effect it has…

I hope this makes sense - the separate branch is not absolutely necessary but theoretically gives you finer control over the whole sorting…

Cheers
Markus
Virus.20.toe (15.3 KB)

Thank you so much Markus! I really appreciate it! Take care.

1 Like