Jump to content

VOP SOP distance calculation


krot

Recommended Posts

Hi guys

How can i get a point attribute (of geometry A) containing distance to the closest point of geometry B?

this need to be done in VOP SOP (using nodes, not coding).

and how can i then modulate this attribute using a curve or a ramp?

to fit it non-lineary in 0 - "cutoff distance" range.

Thank you.

Link to comment
Share on other sites

short answer is to have a look at point clouds...there is loads of info on them in various posts on odforce and sesi as well as the help. You can extract the "distance" between your geo pts and your point cloud pts. Your geo pts would be Geo A and the points you feed into your point cloud will be Geo B.

Link to comment
Share on other sites

short answer is to have a look at point clouds...there is loads of info on them in various posts on odforce and sesi as well as the help. You can extract the "distance" between your geo pts and your point cloud pts. Your geo pts would be Geo A and the points you feed into your point cloud will be Geo B.

thanks.

i just can't get some details:

1. op:`opinputpath(".", 1)` - is this the right way to plug geometry in the vop sop's second port?

2. how do they use this "while loop"?

Link to comment
Share on other sites

thanks.

i just can't get some details:

1. op:`opinputpath(".", 1)` - is this the right way to plug geometry in the vop sop's second port?

2. how do they use this "while loop"?

1. you can do two options, either write out your geo as either a .pc or .bgeo sequence (.pc are ideal for point clouds) and put the sequence into the pcOpen VOP > file parameter, or you can use the "op:" syntax which just reads the geometry in on the fly without writing out the sequence. "op:" is to point to the node you want to look up. ie "op:/obj/geo1/mySop". The `opinputpath(".", 1)` is just saying to look at the node being wired into the 2nd input, (ie 1 as the first input is 0). Either way will work.

2. Depending on what you are going for, you may not need to use a while loop as in Vops they take some getting used to. There is a vop called pcFarthest which returns the distance of the farthest neighbor to your Geo A point.

Link to comment
Share on other sites

you're very welcome.

A couple things to note... on the vopsop the radius is set to 50... this is just a distance threshold for HOW far to look... so if you're spheres are a greater distance than 50 units radius away, then you will need to raise this value. Simply trying to find the distance to the nearest neighbor, you only need to do a lookup for the FIRST nearest point, therefore that's why the max points is only 1... if you start to do more complicated "FILTERED" based point cloud lookups, such as blending the colors of sphere2 to sphere1 - similar to an attributeTransfer SOP, with a setup that is similar to the setup i gave you, this won't work as expected because it simply would copy the value from the NEAREST neighbor to the point being calculated --> as in, there will not be any "BLENDING" of the values from point to point... You need to do a while loop to iterate over the points in the point cloud to get a blending.... In the examples you mentioned earlier, they detail this filtered based method very good for you.

Hope this helps a bit...

Jonathan

Edited by itriix
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...