Jump to content

custom vector fields as forces


anakin78z

Recommended Posts

Hey there,

So, I feel like this should be simple, but I can't figure out how to use a custom vector field as a force in dops.

Basically, I want to build a volume in sops which represents a vector field. I then want to import that volume in dops and use it as a force field.

I can't even figure out how to import the volumes...

Help?

Thanks,

-z

P.S. using the VOP Force sop would probably work for rbds, but won't work for particle fluids.Local variables

Link to comment
Share on other sites

There's multi-threading???

Anyhoo, the fieldforce dop actually works quite nicely. I thought I'd tried it before and found it to be very slow, but I'm finding it plenty fine right now.

I was gonna look into using the Sop Scalar Field dop to import the volumes, but for now the field force is doing the trick.

Thanks!

-z

Link to comment
Share on other sites

hmn... I'm not so sure anymore. You really have to keep the number of points way down to keep the speed reasonable. It slows down pretty fast. This is where I was thinking a volume lookup would be much faster.

Field Force with RBD is terribly slow. It exerts a force on each cell of the Collision SDF, and there is no way to make it affect only the RBD object's center instead. So if you have a high-res collision sdf, or a few of them... OUCH. Same thing goes with the VOP Force DOP.

Field Force with fluids is much more acceptable since there is only one volume to resolve.

I just looked at the Fluid Force DOP and thought it might also try to do this for you - but it seems to just be a FieldForce under the hood grabbing the "vel" field from an Object. If you want to manufacture your force-field in SOPs, for instance, you can use a SOP Vectorfield DOP into a FieldForce DOP to do it.

Link to comment
Share on other sites

that's good to know jason.. explains my different perception because my last test was with fluids. i did remember it as unbearably slow from previous tests... must have been with rbd's then

so i had a new idea. why not apply a force using the uniform force dop and an expression that gets v from the sop point that is closest to each rbd's center.

you'll find a hda that does this in the attached hip file, also a field force for comparison (it's orders of magnitude slower at the default sdf res)

it's not super accurate because there is no interpolation between points, as it just takes the closest one using nearpoint, but it's fast with ten-thousands of points so we can up the resolution of the force geometry if necessary and it should be fine. there will also ways to extend this with interpolation though.

rbdforces.hipnc

Link to comment
Share on other sites

yep, that works! great.

the setup in dops is the same really, but yeah of course you need the volume first.

so here's a new file with a new hda 'SOP Volume Force'

the hda expects 3 fields with x,y,z force values respectively

i was also thinking that maybe you could attach extra geometry data to the rbd's that is used to fetch the force data using sop nodes.

it could just contain one point that is set to the center of the rbd on each simulation step using a sop solver.

with this you'd have a lot of flexibility, e.g. you could get force data from a pointcloud using a vop sop.

the data would then just be a point attribute and could be applied using uniform force dop and a point expression

rbdforces2.hipnc

Edited by Aearon
Link to comment
Share on other sites

i was also thinking that maybe you could attach extra geometry data to the rbd's that is used to fetch the force data using sop nodes.

it could just contain one point that is set to the center of the rbd on each simulation step using a sop solver.

with this you'd have a lot of flexibility, e.g. you could get force data from a pointcloud using a vop sop.

the data would then just be a point attribute and could be applied using uniform force dop and a point expression

Hmn... I was trying to get something like this working, but I couldn't figure out how to make a stable setup. I'm still a bit unclear how to best pass data back and forth between sops and dops without causing cooking issues. If you get this setup working, I'd love to see it.

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