580 lighting, or shading

three kind of light:

ambient

diffuse:

Ie Kd (N•L)

le:power of light

kd:coefficient of diffuse

N:norm of the vector

L:vector from vector to light

it should be  Ie Kd cos(theta), theta is the angle between N and L, but when N and L are normalized, it can be cos(theta)=N*L.

specular:

Ie Ks(R•E)^s

R:vector of the reflection of L,R = 2 * dot(N,L) * N – L

E:vector from vector to eye

s:specular index, the spot is more clear when s is higher

This entry was posted in 未分类. Bookmark the permalink.

Leave a comment