direction of a slope

   4264   6   2
User Avatar
Member
383 posts
Joined:
Offline
Hello,

Let say I have a mesh of a mountain landscape.
I would like to calculate the direction of the slope as a vector.

I tried to loop trough the neighbours (NbP) of each point. Test if theses NbP are under or above the specified point ( compare Y position ). If the NbP are under the point the goal is to calculate the average difference between the point and the NbP as a vector.

First of all : I am not sure if the system is good or not.

i made a hip file to try the system but the result are just … unexpected !

Could you please tell if i am on the right track and what happen to my hip.

thanks for your help

Vincent

Attachments:
slopeDir.hip (116.9 KB)

http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
383 posts
Joined:
Offline
After investigate a little, it looks like my if statement miss a loop …
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
8594 posts
Joined: July 2007
Offline
can't you just do this?
vector down = {0,-1,0};
v@slopedir = normalize(cross(cross(v@N, down), v@N));
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
383 posts
Joined:
Offline
nice.
It should work

thank a lot
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
383 posts
Joined:
Offline
hmm …
i may have a new request.

What should the way to add some noise on this vector field. Nut the vector should stay “sticking” on the mesh.
In my mind, the new orientation of the vectors should be dependent of the normal of the mesh but i can't see how to constuct something with … let say a turbulence noise.

thank again.
http://vimeo.com/vbkstudio [vimeo.com]
User Avatar
Member
8594 posts
Joined: July 2007
Offline
here is file with 2 methods

Attachments:
ts_slopedir_with_noise.hip (165.1 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
383 posts
Joined:
Offline
excellent !

thanks a lot
http://vimeo.com/vbkstudio [vimeo.com]
  • Quick Links