Jump to content

Finding out how many edges are connected to a point? (and a few other questions...)


Recommended Posts

 

Hi there,

 
I want to rebuild an old tree model that uses cards with opacity maps and swap them for geo. Conveniently each 'card' is a pyramid with the centre point next to the branch.
 
So the idea is to find the centre point of each card by the fact that is has 4 edges connected to it while the outer points only have 3. Then average the vector between the centre and 4 edge points, which will give me an 'up' vector, which I can then use to rotate some geometry around it.
 
How would you go about this? I'm fairly new to Houdini, so I know the steps I want to take but actually executing them is proving difficult.
 
And assuming there's a few thousand leaves on the tree this has to be relatively economical to run. Should I instance geo onto the leaves (with random scale/offset/noise), or would using curves/fur make more sense? Its a pine tree kind of thing so has spines more than leaves.
 
Below is a simplified version of what I'm trying to achieve.
 
Thanks for any pointers.
 
Cards on branch

cards.jpg

Replaced with geo.

geo.jpg

Edited by Martin B
Link to comment
Share on other sites

you can use the neighbours vop or vex function to get an array of each points neighbours

test if a point has more than 3 neighbours with neighbourcount vop/vex function

if it does, loop through its neighbours and average the direction vectors to get your normal vector

if it doesn't, remove it.

this will give you just the centers of your cards with the correct normal vectors that you can use to build the rest of your coordinate system.

you also can delete the primitives after your operations

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