Hello everyone.
What I am trying to do is very simple:
I have a grid as a cloth and a sphere as a collider.
I added some wind so it's easier for me to see the test result.
I have an "attach to geometry" vellum constraint from the grid to the collider.
I only want the tip of the grid to be attached to the collider, so I created a paint attribute node and painted the grid's tip area. Then I used the painted attribute to scale the stretch stiffness value inside the constraint.
Now I want the constraint at some point to release itself so the grid will fly into nothingness.
However, I noticed that using the "vellum constraint property" inside the solver will completely replace the value of the constraint, and there is no option to scale the value by attribute.
To keep my scaled value, my current solution is on the "vellum constraint property" I set the stiffness value to 0 and animate the activation attribute instead.
However, I feel like there is a better solution than this, especially since you can't animate gradual value with activation which is an int attribute.
So my question is
1. Is there a way to keep my constraint value from the SOP level and multiply it with the animation in the "vellum constraint property"?
2. How can I bring in my painted attribute and multiply it with the animation in the "vellum constraint property"?
I have attached my scene to the post.
Thank you very much.
Animating Vellum Constraint
3328 10 2- weerapot-c
- Member
- 12 posts
- Joined: 1月 2019
- Offline
- freshbaked
- Member
- 121 posts
- Joined: 6月 2020
- Offline
I think this is a little over complicated. You're attaching all the grid points to the sphere then telling some to be very stretchy to bahave like they aren't attached (I think?). You can just use the maxdist parameter on the attach to geo constraints to only constrain the grid points that are within a certain distance to the sphere, output a group for those constraints, then use a vellumconstraintproperty to delete those constraints after a certain frame to detach the grid.
Hopefully I understood what you're trying to accomplish and that the attached file helps.
Hopefully I understood what you're trying to accomplish and that the attached file helps.
- weerapot-c
- Member
- 12 posts
- Joined: 1月 2019
- Offline
Thank you for your input.
My goal is to control the strength of the constraint using an attribute paint map.
So I used stretch stiffness which gets scaled by the painted attribute (if anyone has suggestions to use any other attribute please tell me).
If I am only concerned by which point gets attached to the collider, then in the geometry group I would put the expression similar to "@paintattrmap>0".
But it will disregard the paint map value (e.g. 0.5) and just constrain the point with value to the collider instead.
In the real production application, it would be to control which area of the pants would get attached to the body, and how strong each point would get attached to the body.
So while your solution is great, it defeats my goal of using the attribute paint to control vellum constraint.
But maybe my logic is flawed. In that case, please feel free to correct me.
Thank you very much.
My goal is to control the strength of the constraint using an attribute paint map.
So I used stretch stiffness which gets scaled by the painted attribute (if anyone has suggestions to use any other attribute please tell me).
If I am only concerned by which point gets attached to the collider, then in the geometry group I would put the expression similar to "@paintattrmap>0".
But it will disregard the paint map value (e.g. 0.5) and just constrain the point with value to the collider instead.
In the real production application, it would be to control which area of the pants would get attached to the body, and how strong each point would get attached to the body.
So while your solution is great, it defeats my goal of using the attribute paint to control vellum constraint.
But maybe my logic is flawed. In that case, please feel free to correct me.
Thank you very much.
- freshbaked
- Member
- 121 posts
- Joined: 6月 2020
- Offline
I see, you mentioned only wanting to attach the tip of the grid to the collider, in your setup every point of the grid was attached to the sphere.
You also mentioned wanting it to detach at some point which it wasn't.
But if all you want to do is scale the stiffness of the attach constraints then you had that working fine and you can add that to the file I provided.
If you further want to scale/animate the stiffness during the simulation just use a geometry wrangle, run over the attach constraints, and scale the stiffness however you like.
Or with the vellumconstraintproperties use a VEXpression and scale stiffness by the stiffness parameter which you can keyframe.
f@stiffness *= stiffness; should work.
You also mentioned wanting it to detach at some point which it wasn't.
But if all you want to do is scale the stiffness of the attach constraints then you had that working fine and you can add that to the file I provided.
If you further want to scale/animate the stiffness during the simulation just use a geometry wrangle, run over the attach constraints, and scale the stiffness however you like.
Or with the vellumconstraintproperties use a VEXpression and scale stiffness by the stiffness parameter which you can keyframe.
f@stiffness *= stiffness; should work.
Edited by freshbaked - 2023年4月30日 20:29:19
- weerapot-c
- Member
- 12 posts
- Joined: 1月 2019
- Offline
Hello, thank you once again for your input.
I have been trying to use VEX inside the "vellum constraint property" and "geometry wrangle" for a while now, and I failed to scale the animated "vellum constraint property"'s attribute with the painted attribute.
Simply use something like:
or
...doesn't really work for me. I don't really get how data and attribute transfer in this case.
I will need help regarding this.
Thank you.
edited: I have tried your above code and it doesn't work for me either.
I have been trying to use VEX inside the "vellum constraint property" and "geometry wrangle" for a while now, and I failed to scale the animated "vellum constraint property"'s attribute with the painted attribute.
Simply use something like:
@stiffness *= @paintedattribute;
or
@stretchstiffness *= @stiffness;
...doesn't really work for me. I don't really get how data and attribute transfer in this case.
I will need help regarding this.
Thank you.
edited: I have tried your above code and it doesn't work for me either.
Edited by weerapot-c - 2023年4月30日 20:49:23
- freshbaked
- Member
- 121 posts
- Joined: 6月 2020
- Offline
The reason your first example isn't working is because your painted attribute doesn't exist on the constraints.
The reason your second example isn't working is because the attribute is called "stiffness" not "stretchstiffness" and to refer to paramters on a node in VEXpressions you simply use the parameter name (without @).
Edit:
actually I'm dumb, the VEXpression on the vellumconprops won't work at all, I should have tested it first. I don't see why a geo wrangle wouldn't though, just make sure you're running over the constraint prims and you can scale it however you want.
The reason your second example isn't working is because the attribute is called "stiffness" not "stretchstiffness" and to refer to paramters on a node in VEXpressions you simply use the parameter name (without @).
Edit:
actually I'm dumb, the VEXpression on the vellumconprops won't work at all, I should have tested it first. I don't see why a geo wrangle wouldn't though, just make sure you're running over the constraint prims and you can scale it however you want.
Edited by freshbaked - 2023年4月30日 21:23:36
- weerapot-c
- Member
- 12 posts
- Joined: 1月 2019
- Offline
Hello again. Thank you for your continuous input and for taking the time to explain things to me. I finally got it to work.
It's quite simple in the end. I can just animate constraint on the SOP level and transfer it into DOP.
On the SOP, I used enumerate node to create primID on constraint geometry, since primnum changes when you plug them into the DOP network.
In the DOP, I used geometry wrangle.
Here's the code:
Just make sure that on the Data binding tab, you set Geometry to "ConstraintGeometry".
And on the Inputs tab, input 2 is set to "Second Context Geometry".
Cheers,
It's quite simple in the end. I can just animate constraint on the SOP level and transfer it into DOP.
On the SOP, I used enumerate node to create primID on constraint geometry, since primnum changes when you plug them into the DOP network.
In the DOP, I used geometry wrangle.
Here's the code:
int pr = idtoprim(1, @id); @stiffness = prim(1, 'stiffness', pr);
Just make sure that on the Data binding tab, you set Geometry to "ConstraintGeometry".
And on the Inputs tab, input 2 is set to "Second Context Geometry".
Cheers,
- jamison1
- Member
- 15 posts
- Joined: 1月 2017
- Offline
- jamison1
- Member
- 15 posts
- Joined: 1月 2017
- Offline
how do you set the geo wrangle inside the DOP to just change the constraints of a certain type, for example i need Attach to Geometry constraints animated. That node uses "stretchstiffness" to change its adhesion to the animated prims.
so when i put a geo wrangle in vellum solver, and change just @stiffness, does this not change all the constraints, such as the vellum cloth constraints and any other ones setup too?
how do i target the wrangle to work on JUST the attach to geometry constraints?
cheers
J
so when i put a geo wrangle in vellum solver, and change just @stiffness, does this not change all the constraints, such as the vellum cloth constraints and any other ones setup too?
how do i target the wrangle to work on JUST the attach to geometry constraints?
cheers
J
- weerapot-c
- Member
- 12 posts
- Joined: 1月 2019
- Offline
Hey Jamison.
I made a video regarding animating vellum constraint just in case:
https://youtu.be/WbayaOkBg3E?si=hsQJB9ZeEYwK5c8P [youtu.be]
Should have the hip scene in the description.
I need to do some experiment for your case, but on top of my head I would just set up the wrangle like in the video for each of your constraint and use 1 parameter to drive all of your constraints' stiffness on the SOP level.
Cheers,
Wch
I made a video regarding animating vellum constraint just in case:
https://youtu.be/WbayaOkBg3E?si=hsQJB9ZeEYwK5c8P [youtu.be]
Should have the hip scene in the description.
I need to do some experiment for your case, but on top of my head I would just set up the wrangle like in the video for each of your constraint and use 1 parameter to drive all of your constraints' stiffness on the SOP level.
Cheers,
Wch
- jamison1
- Member
- 15 posts
- Joined: 1月 2017
- Offline
legend.
i eventually got it working with the wrangle, which did let me write the constraint group name in its group entry. setting the wrangles second input to fetch the constraints.
i could NOT get the vellum constraints property to work using the group name, even with the same vex code snippet. very strange. but at least the wrangle works!
appreciate the help. your a star.
i eventually got it working with the wrangle, which did let me write the constraint group name in its group entry. setting the wrangles second input to fetch the constraints.
i could NOT get the vellum constraints property to work using the group name, even with the same vex code snippet. very strange. but at least the wrangle works!
appreciate the help. your a star.
-
- Quick Links