Showing posts with label blast. Show all posts
Showing posts with label blast. Show all posts

Monday, 7 April 2025

getting areas of pieces and removing them. Eg object is being divided somehow.

 


Say you want to blast the large lower shape to just get the caps, but this shape is evolving and moving (and therefore the parts you want to delete are changing in size & number/point count etc!)....
You gotta measure the area of each "connected" piece, then kill them based on a threshold. It's easy when you say that, but actually there's a bit of other stuff involved.
   

This is the rough setup.
So make a For Each block & set it to Primitives. Do a Measure - select Area. This only gives us the area per FACE. We want the whole piece's area. Sooo, we promote it to Detail level & use the SUM promotion method. ie - it adds all the area attribs on a piece together. 


Once this has been done I promote the attribute back to Point level (using average as the promotion method).

Outside of the loop we can write a little wrangle to delete the pieces based on area-

Just a simple removepoint expression. I use a float channel slider so that the value can be tuned for the animation. it might not be necessary for you.

Shoutout to Felix for helping out with the attribute promoting bits!








Friday, 12 April 2019

removing RBD from a sim

Sometimes you need to remove an RBD from a sim completely. Eg, you're using a block to push something and then need it to get out of the way...

Make sure you have a group for it on SOP level. It will probably be a point group, as you're most likely using packed geo.

Now use a SOP solver in your DOP network. Attach it to a multisolver, alongside your Bullet/RBD solver..
Inside the SOP solver, blast the group that you created earlier. Use a switch node or some other timing device (you could use a point wrangle with removepoint I think)  to trigger the group's deletion.
Eg. Switch node  could use $F>1000. Here it will switch from "all the geo" to "all the geo minus the group" input.

Select a random point from a group each frame

Some code snippets from Walter to use points from a group randomly, for emission (or other things)

In a Detail Attribute Wrangle-

int npts = npoints(0);
float keep = rand(@Time + 235.624) * npts;
i@keep = int(keep);

Every time step, a random point id is chosen as the "keep" point.

Then in a blast, we kill everything but the kept point

`detail(0, "keep", 0)`

Don't forget to invert the blast selection