Jump to content

Distance to edge of prim


Rudinie

Recommended Posts

I'm trying to find a way to calculate the distance between a point that's scattered onto a primitive and the closest edge of that primitive. I did find a relatively easy way to get the distance to the primitive's centroid but that's not exactally what i need. I want to use this to fade out the effect of a noisefield in a custom vopsop when getting close to the edge of the primitive.

Could anyone give me a hint?

Link to comment
Share on other sites

I'm trying to find a way to calculate the distance between a point that's scattered onto a primitive and the closest edge of that primitive. I did find a relatively easy way to get the distance to the primitive's centroid but that's not exactally what i need. I want to use this to fade out the effect of a noisefield in a custom vopsop when getting close to the edge of the primitive.

Could anyone give me a hint?

I don't know if this is the best solution.

Add a Divide SOP to the primitive, turn on "Remove Shared Edges" and then add a Polywire SOP. Then create a custom attribute on your primitive and use a Point SOP to calculate the distance of each point to the closest surface of the Polywire. Using the "pointdist" expression. You can then use this attribute in your vopsop to weight the noisefield.

Link to comment
Share on other sites

Use point clouds.

Cool thanks, this is working the way i would want it to. I do however have a hard time understanding the point cloud farthest vex node. Help tells me it returns the distance to the farthest of the sampled points. So in this case every scattered point is measured against all points on the resampled outline. So if the vex function is actually returning the highest found distance, the returned value should be highest on the edges right? (because the edge on the other side is very far away) What mistake am i making?

Link to comment
Share on other sites

Cool thanks, this is working the way i would want it to. I do however have a hard time understanding the point cloud farthest vex node. Help tells me it returns the distance to the farthest of the sampled points. So in this case every scattered point is measured against all points on the resampled outline. So if the vex function is actually returning the highest found distance, the returned value should be highest on the edges right? (because the edge on the other side is very far away) What mistake am i making?

Check the amount of points fetched from the point cloud:) It is set to 1. So the only point from that particular query happens to be the nearst and farthest at the same time:)

FarthestVOP simply returns greatest distance found. In this case it returns shortest distance to the edge points. Hahaha what a brain fucker. Anyway, you could just import it's position and use DistanceVOP if you like.

  • Like 1
Link to comment
Share on other sites

Check the amount of points fetched from the point cloud:) It is set to 1. So the only point from that particular query happens to be the nearst and farthest at the same time:)

FarthestVOP simply returns greatest distance found. In this case it returns shortest distance to the edge points. Hahaha what a brain fucker. Anyway, you could just import it's position and use DistanceVOP if you like.

I thought of that earlier this morning, it must be the first one it finds and it stops right there. Clever guy who programmed this funcion.

Those pointclouds could be usefull in plenty occasion, must check it out. Thanks for helping me! I will show what i made with it soon.

  • Like 1
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...