How to find normal of point neighbour

   1159   8   1
User Avatar
Member
8 posts
Joined: March 2014
Offline
Hello,

I want to use dot product to calculate points and neighbours points normal on same geometry,
try to make some effect like ambience occlusion.
I've use array and for loop to try to find them, but it {0,0,0}...

I know that I can use mask by feature node to get ambience occlusion,
but I just want to know how to get neighbours point normal.

Can someone tell me how to fix it?

And sorry for my english.

int pt_neighbors[] = neighbours(0, @ptnum);
int num_neighbors = len(pt_neighbors);

vector myNormal = point(0, "N", @ptnum);



for (int i = 0; i < num_neighbors; ++i) {
    int neighbor = pt_neighbors[i];
    v@neighborNormal = point(0, "N", neighbor);//it's {0,0,0}
    
    f@dot =dot(myNormal, @neighborNormal);
    
}
Edited by Cuanyo - Aug. 6, 2023 01:56:47
User Avatar
Member
8 posts
Joined: March 2014
Offline
Ok it's a stupid mistake, the default pighead test geometry is no normal data...
However, it's not my expect result, not like ambience occlusion.
User Avatar
Member
122 posts
Joined: Aug. 2017
Offline
Try to use FeELib-for-Houdini it has endless otls collection and examples like eigenvector neighbors that you can calculate from any direction to make desired effect.
Conservation of Momentum
User Avatar
Member
8597 posts
Joined: July 2007
Offline
you can also use Mask By Feature SOP to get Ambient Occlusion based mask attribute
and if you are interested dive inside to look at the code
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
8 posts
Joined: March 2014
Offline
tamte
you can also use Mask By Feature SOP to get Ambient Occlusion based mask attribute
and if you are interested dive inside to look at the code
Thanks for the advice!

I didn't know that node is a subnet, I've dive to look at the code, it's super difficult to me.
hope some day I can understand it.

Thanks again!
User Avatar
Member
8 posts
Joined: March 2014
Offline
cncverkstad
Try to use FeELib-for-Houdini it has endless otls collection and examples like eigenvector neighbors that you can calculate from any direction to make desired effect.
Thanks for the information!
User Avatar
Member
4531 posts
Joined: Feb. 2012
Offline
Hi,

You can also use the primuv function to sample normals anywhere on the surface:

https://www.sidefx.com/docs/houdini/vex/functions/primuv.html [www.sidefx.com]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
8 posts
Joined: March 2014
Offline
animatrix_
You can also use the primuv function to sample normals anywhere on the surface:
Thanks!
I'll try to find out how to use this function.
User Avatar
Member
102 posts
Joined: June 2023
Offline
I think you just don't have a normal on the points.
I have run your code and it works. Just put the "Normal" node in front of the wrangle and specify the "points".
  • Quick Links