Calculating surface normal from height

Tweet


Height H is assigned for each point (x,y) in 2D grid.

The following p and q are called gradient.

Normal n is calculated by p and q as follows.

If you want an unit vector, normalize this n.


Back