SLIDE 5 OpenGL’s Lighting model
Emission term: The material emissive light value (GL_EMISSION) Attenuation Factor: Spotlight Effect:
ON _ATTENUATI GL_QUADRIC N ATTENUATIO GL_LINEAR_ ION T_ATTENUAT GL_CONSTAN vertex and source light between distance − − − −
q l c
k k k d
2
1 d k d k k
q l c
+ +
⋅ =
EXPONENT SPOT GL _ _
} , max{ cone light the
is vertex the If spotlight a not is light the If 1 d v
TION) SPOT_DIREC (GL_ direction spots the is ) , , ( vertex. the to spotlight the from points r that unit vecto the is ) , , (
x z y z y x
d d d v v v = = d v
i
vertex color * attenuation_factor*spotlight_effect*( )
material light_model material i lights sources
emission ambient ambient ambient diffuse specular = + + + +
∑
OpenGL’s Lighting model
Ambient Term: light’s ambient color multiplied by the
materials (GL_AMBIENT):
Note: The multiplication above is individually for the
R,G,B and A color components.
Diffuse Term: The direct light that reaches the vertex. It
is directional depended:
glNormal3{ bsidf} (TYPE nx, TYPE ny, TYPE nz) glNormal3{ bsidf} v(TYPE * v) - Defines the current normal vector.
Next time glVertex will be called, the current normal will be assigned to the vertex.
Note: OpenGL - can receive non- unit normals and normalize them if glEnable(GL_NORMALIZE) is called.
light material
ambient ambient *
light material diffuse
diffuse * }) , (max{ ⋅ ⋅n L
vertex. at the vector normal unit the Is ) , , ( ON) (GL_POSITI position light the vertex to the from points r that unit vecto the Is ) , , (
x y x z y x
n n n L L L = = n L