Jump to content

Grouping by distance from point


Recommended Posts

I have some particles creating a rippling effect on a sphere, and I want to subdivide the geometry near the hits for better detail. I figured the best way to do this would be to measure the distance of each primitive from the impact position, and if it is within a certain threshhold add it to a group to be subdivided.

I started to do this with a VOP SOP by hooking my sphere geometry up to the first input and my impact positions (basically a few points scattered across that sphere) into the second input. I tried to use the 'import attrib' VOP to get the P attribute of my second input, but I think it is giving me errors due to the unequal number of points.

2 questions. Could someone point out what I am doing wrong in VOPs? Secondly, is there an easier way to do what I am trying to do?

vopsop_test.hipnc.hip

Link to comment
Share on other sites

Do you need the rippling effect for actual geometry deformation? If you're rendering the effect, displacement is the better way to go.

If you search through the forums for shaders creating ripples, you can use the Add Hit Position UV Attribute option in the Collision POP to find out where the particle is hitting the sphere & use that position to as the origin for the ripple.

Cheers!

steven

Link to comment
Share on other sites

Do you need the rippling effect for actual geometry deformation? If you're rendering the effect, displacement is the better way to go.

Cheers!

steven

I don't think I necessarily need the geometry to be deformed, since there isn't anything else interacting with it. I'll go ahead an try that method.

For my edification, is my VOPSOP method not working due to a minor implementation error or is it something more substantial?

Link to comment
Share on other sites

  • 4 weeks later...

ok, first off, not trying to ignore the VOPSOP q, but i'm simply not familiar enough with VOPs to be helpful there.

so, "grouping by distance from point" seems to be doable with bounding spheres or piped in metaballs. so i took the Delete and plugged that along with a Metaball into a Copy and that into a Group.

in order to test multiple points in the Delete, in the Filter Expression param, i put in the expression: $PT == int(rand(100*$PT*$F) * $N)

so, my question is, how is it possible on certain frames ( 3-5 ) there are ZERO points selected??

follow-up q, how to test out an expression like this? "echo `rand(100)" in the textport is as far as i got. didn't see anything in the spreadsheet or when scoping the channel.

thanks in advance.

OU42_vopsop_test.hipnc

Link to comment
Share on other sites

to your VOP question:

2 things to say

1. the way vops/vex work is that the network you build is run for every point of the first input geometry, so there is no need to loop them inside

2. connections in your VOPs are wrong, so it cannot work. It simply loops 10 times for each point and creates new point attribute called "id" with value of 10

look a this example for correct usage

I used for loop to cycle all points in the second input (you now have only 1 but you may have more so you need to loop them)

and inside the loop it checks the distance according to the max radius you can specify as a parameter

and then creates a point group if that point is in that radius (from any of the second input points)

then i used group node to convert point group created by VOPs to a primitive group so it can be used in subdivide SOP

hope this will help you better understand VOPs

tomas

vopsop_test_2.hip

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