Jump to content

SOP Solver with shatter


dyankov

Recommended Posts

Hey there, first post :)

First I'd like to say in my defence that I looked all over the docs, SideFX forum and searched this forum as well and couldn't find anything that solves this problem, but anyway sorry if this has been asked before.

So, I have an RBD object containing a single geometry piece called 'cube' and on impact in the sop solver's sopnet is activated a shatter node and the resulting output is like 10+ objects (all grouped like they should, using connectivity + partition), but the problem is that they stick together after the impact. When I middle-click it still says that I have only one object ('cube') instead of all the pieces.

I'm attaching the file. Please help me out here, I don't know where else to look for info on this. As far as I understand, I have to do something with the new objects that are not coming out of the SOP Network.

shattering_cube.hipnc

Link to comment
Share on other sites

Hi again, I actually found an example file showing a sphere shattering in smaller and smaller pieces. The example name is AutoFracturing.

It starts with a single sphere and then the Copy Objects node creates 8 object and I don't understand how that works. If only anyone could explain this example to me, maybe I could solve the problem in my own sim? Thanks a lot!

Link to comment
Share on other sites

I read all the notes in that network, but it's still hard to understand what's really going on. For example, the Copy Objects node is using the group objects_to_split, which I cannot find where does it come from.

Anyway, I'm not 100% sure that this example will solve my problem. I'd be happy if you gave me any directions on that issue. Thanks

Link to comment
Share on other sites

I think this is what you want.

you are able to use the Copy Objcts DOP to get objects you want to copy, then use the SOP Geometry DOP to get each single primitive object, finally lay down a Delete DOP to delete source object.

I referred the topic Voronoi - dynamic - location based fracture in the forum

shattering_cube_correct.hipnc

Link to comment
Share on other sites

Thank you so much, that's exactly what I needed! I noticed just one small issue - the cube falls, then bounces off the ground and 1 frame later it shatters. Shouldn't it be shattering as soon as it hits the ground and the pieces start flying in all directions? I just imagined it that way when I was starting the simulation. Thanks again!

Link to comment
Share on other sites

Thank you so much, that's exactly what I needed! I noticed just one small issue - the cube falls, then bounces off the ground and 1 frame later it shatters. Shouldn't it be shattering as soon as it hits the ground and the pieces start flying in all directions? I just imagined it that way when I was starting the simulation. Thanks again!

that's because the primitive objects are created after the cube hits the ground. for the sence, the cube hits the ground at frame 16, then those objects are created at frame 17, that's why I typed the expression $OBJCF == $SF in the group1.

we get the dopobjects using the SOP Geometry DOP.

if you want to let the pieces start flying in all directions. Maybe you have to modify those velocity.

Link to comment
Share on other sites

Yes, in the RBD state I put a rand() funcion for the velocity and it turned out pretty well.

The reason that I wanted the cube to shatter on impact (or impulse) was different though. I was hoping that when the cube shatters, each individual piece can shatter as well, if it gets the needed impulse, say from an object falling from above, but it's not working for some reason. But I'll do my homework, thanks for the help so far :)

Link to comment
Share on other sites

Thank you so much, that's exactly what I needed! I noticed just one small issue - the cube falls, then bounces off the ground and 1 frame later it shatters. Shouldn't it be shattering as soon as it hits the ground and the pieces start flying in all directions? I just imagined it that way when I was starting the simulation. Thanks again!

Turning up the "Substeps" parameter on the DOP Network (anywhere from 2 to 4 or so) should make the intact / fractured transition appear smoother.

Link to comment
Share on other sites

you can modity objtocopy parameter in the Copy Objects DOP. we can use the sourceobjid value to copy each primitive group object if you want to let each primitive group object continue shattering when they have Impacts.

so we must create a attribute value named sourceobjid in the fracture, then read the value in the objtocopy parameter.

Link to comment
Share on other sites

you can modity objtocopy parameter in the Copy Objects DOP. we can use the sourceobjid value to copy each primitive group object if you want to let each primitive group object continue shattering when they have Impacts.

so we must create a attribute value named sourceobjid in the fracture, then read the value in the objtocopy parameter.

auto_shattering_cube.hipnc

Link to comment
Share on other sites

you can modity objtocopy parameter in the Copy Objects DOP. we can use the sourceobjid value to copy each primitive group object if you want to let each primitive group object continue shattering when they have Impacts.

so we must create a attribute value named sourceobjid in the fracture, then read the value in the objtocopy parameter.

Link to comment
Share on other sites

Thanks, I will take a look at it.

P.S. I took a look in the docs about the prim() and nprims() functions, but their description there says so little. For example, I'm guessing that you're using prim() to get each primitive group that comes out of the fracture SOP and copy it to a new object, right? Here's what the docs say:

When given the “P” or “Pw” attribute, returns the centroid of the primitive.
Link to comment
Share on other sites

we can use a sourceobjid of dopobject to stand for this dopobject.

for example, if the sourceobjid value of cube is 1, then we can use the value to stand for the cube and apply it everywhere.

we want each primitive group object continuing shattering, so we must know which object is copied. so we have a sourceobjid and tell the Copy Objects DOP to copy each primitive group object, then use Delete Dop to delete source object where we also use sourceobjid.

we use prim() expression to get sourceobjid value of primitive 0 in each primitive group object.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...