cg-old icon indicating copy to clipboard operation
cg-old copied to clipboard

Getting the normal from a point on a surface

Open oveddan opened this issue 8 years ago • 2 comments

Lets say you have a single point on a surface, and you want to get its normal. The surface is generated procedurally.

What would be the proper way to get the normal of a point if you can sample nearby positions and get their position on the surface?

oveddan avatar Dec 16 '16 06:12 oveddan

  1. If your surface is defined explicitly with a C1 function f(u,v) -> x,y,z you can simply take the cross product of its 2 two partial derivatives (df/dx cross df/dy)

  2. If 1 does not apply, you can sample a few nearby points, fit a plane in the least square (http://stackoverflow.com/questions/1400213/3d-least-squares-plane) and then use the normal of the plane. In this case, you have to be careful to always pick a consistent orientation for all your normals.

danielepanozzo avatar Dec 16 '16 14:12 danielepanozzo

thank you, that helped!

oveddan avatar Dec 18 '16 05:12 oveddan