Jump to content

How to activate simulation on parts of geometry in controllable manner


fragmentzero

Recommended Posts

Hello,

I have a geometry created by "scattering" cubes over a surface.

And now trying to apply forces on the cube in sequential manner (small groups of cubes get simulated one after another).

Please see attached image.

Right now, I am using a Box SOP (step animated) in mask field for activation of groups.

However, it seems to be having some issues.

Due to the mask being animated, once the activated bunch goes out of the box, they don't follow the settings in forces.

I started to somehow fix it by setting box sizes or thinking that "nested masks" could help (if there is such thing).

But then I may be looking into wrong method for this effect.

I am reading about the Activate DOP to achieve this and looking for more suitable examples.

The goal is to activate simulation on surface of cubes based on inclusion in some arbitrary shaped mask box (active if inside the box). The shape of mask box will be changing over time.

Any help on this would be appreciated.

Thanks

**Note : I am at beginner level in Houdini. **

post-9105-0-66036100-1358998962_thumb.jp

Edited by vishangshah
Link to comment
Share on other sites

you can use a group sop and use the group in the active value dop node or other nodes. One idea (I believe you used copy stamping), is to group the points that generated the cubes (in sop), and send that to dops.

As an example, you can create an attribute "in_group", using 1 for an object in the group and 0 for outside, then in the dop group node, use a point expression, but in the point number use $OBJID. Look for the object ID in the spreadsheet to see if is equal to the point number that generated the objetc (you can create in dops an attribute that is equal to the point number that generated the cubes, than in the "geometry" field, in dops, look for that attribute and see if it matches the objid).

Since you can use expressions in the group node in dops, perhaps you can mimic the expression you used in sops and do it only in dops too, but I think what I wrote is already a start point...

Link to comment
Share on other sites

Hi Guilherme,

Thanks for reply.

Since I am a beginner, I had to read some docs to understand your description. :)

I managed to get the ActiveValue selection working by creating groups using partition SOP and using them in point expression inside ActiveValue.

I also tried to use DOP group but didn't get the result yet.

I understood what you mean by creating "in_group" attribute and using it in DOP but couldn't figure out how to do that.

And I have attached my scene file to show what I have done so far.

Basically, I am aiming to "voxelize" a surface or volume by throwing scatter points and making boxes with copy SOP. And then I am going to have either a geometry to act as masking group for DOP activation (which will be animated) or bunch of geometries activated one after another for masking. (whichever would be easiest).

Thanks again.

Test_004.hipnc

Link to comment
Share on other sites

Hi, I made it to work. In sops, look for the way I created the groups in the copy sop, instead of using more operators. I used a foreach to created the points corresponding to the boxes, but I could use another copy sop, but copying points instead.

Anyways, I used a dop group and then an active value node beacause for me it´s easier to control the sim- like, you may want the object to be active but not suffer from gravity, if the boxes start to fall from the top ones. I used this technique to control the movement of the groud pieces in this project (https://vimeo.com/56452832). All the pieces are active, but the force only work in the pieces that was in a group done in sops, the same way I did in your file.

In dops, see that the way I tried to mirror the group sops didn´t work, beacause the objects IDs didn´t match the points numbers. That´s why I subtracted 2 ($OBJECTID - 2) to the object id. I looked in the spreadsheet and saw that piece0 had id = 2... I don´t know how to change this behavior of dops yet, but this trick works fine. Just keep an eye in the spreadsheet, if you add another object in the mix, probably you will have to fix the group exp again.

----------

I added a sop solver in the mix just to make it funny, but you can delete the sop solver and the multi solver and plug the rigid body solver in the chain that will work fine (and faster!)

test_004b.hipnc

Edited by gui
Link to comment
Share on other sites

Hi,

It's working now with your help.

I have attached my version.

Also,

  1. Yes, the $OBJID - 2 is weird and without it DOP either skips couple of group members or shows "out of array" kind of warning.
  2. In the ForEach where you added points at centroid, why does connecting each1 to add1 break it?
    I thought all nodes inside foreach needs to be connected.

Thanks

Test_005.hipnc

Link to comment
Share on other sites

1. don't use $OBJID for this kind of things, it is very dangerous, since adding any dop object to the dop network from the left side will shift objids of your pieces, so instead of $OBJID - ?, use just $OBJ

since $OBJ is local index of the object within node processing it, it will be always predictable

and you don't need to group dop objects prior to assigning active value, just use the expression directly in Active Value DOP's active parameter

2. it will break because it will add the centroid to the input geometry and therefore output many points for each iteration instead of just one, the centroid

for each doesn't care if you connect the nodes or not, it will simply output whatever geometry is in display node for each iteration

Link to comment
Share on other sites

Hello,

How do you make sure that non-simulating geometry is hidden (in Render and Viewport) until it becomes active and then stay visible as well simulated once activated?

I am trying to make the geo visible only when it's inside active group, but masking anything before copy sop is creating issues in the simulation.

I guess every time masking data changes, the simulation only considers currently available geo.

Test file attached (but I am sure I am doing this wrong).

Thanks

Hide_until_Active.hipnc

Link to comment
Share on other sites

Thanks for the info, anim, didn´t know about using only $OBJ. I usually use expressions in group instead of in the active value because for me it´s easier, but I don´t know about speed.

visangshah, in the file I posted, I used a sop solver to change the object color once it´s active. Just use that in sops to drive it´s alpha attr.

Link to comment
Share on other sites

I tried to use point/primitive SOP to set initial Alpha value to 0 and then was thinking of enabling alpha in SOP solver.

However, the alpha value of 0 doesn't seem to work in the render, works only in viewport.

Scaling the boxes from 0 to actual size could be interesting, but I suspect that approach will mess up the simulation itself (haven't tried though).

Link to comment
Share on other sites

in the post #4, I added a file that contains a solution for your problem. The boxes became red as they are activated. Use this attribute in sops to change the alpha values - since red = (1, 0, 0), you can use the expression 1 - $CB in the alpha value to make the boxes visible when they are active.

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...