Jump to content
Martin B

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks for the direction. I made some headway and learnt some cool stuff but ended up using a fur system straight on the branches. Its come out pretty good for what I need so going to go that route.

Share this post


Link to post
Share on other sites

Hi, hopefully you may still find this useful, I attached a file outlining the workflow David provided above.

Inside, I also created temporary meshes based off the image you attached.

 

Done with H15.5.607 Indie

H15_leaf_swap.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×