PDA

View Full Version : View diection / surface normal

ken84shin
01-04-2010, 02:30 AM
hi,

had this equation to program but do not know what some of the parameters meant.

cdot(e) = (1+V.N)/2

This formula is a=for an edge(e)

What does this line mean?

the orientation of its surface normal (~N) with respect to the view direction (~V)

In programming, how do I get the V and the N for each edge of an object.

Thanks for the help.
Fyi, I do noe have in-depth knowledge on vectors/ 3D stuff.

dehebo
01-04-2010, 03:40 AM
what I can tell you is that:

V.N is the dot product of two vectors V & N (View prob stands for Vertex, N for Normal).
The dot product is the cos of the angle between the two vectors. look up on wikipedia or something.

The formula wants these two vectors as unit vectors(their length = 1.0). When you take the dot product of two unit vectors the result will lie between the range of -1.0 and 1.0.

The formula (1 + V.N)/2 is to bring this end result into a range of 0.0 to 1.0.