Interactive OpenGL 1.1 model

Lighting equation lab

Adjust the material, light and vectors. The large render shows their clamped sum; the three smaller views isolate exactly where each part comes from. This is one directional light, so attenuation f = 1.

at the selected point I = clamp( ma ⊙ la + md ⊙ ld max(0, N·L) + ms ⊙ ls max(0, R·V)mh )

The same equation, evaluated one step at a time

Every number below is read straight off the controls and the point you selected on the sphere.

all steps

    Final render

    Click or drag on the sphere to inspect a normal
    ambient + diffuse + specular
    Selected point — unclamped → displayed
    not clamped
    Ambient
    ma ⊙ la — independent of direction
    Diffuse
    md ⊙ ld × max(0, N·L)
    Specular
    ms ⊙ ls × max(0, R·V)mh
    N · L
    Diffuse factor
    R · V
    Specular factor

    Material colours

    m

    Light colours

    l

    Directions + finish

    unit vectors
    Shininess mh

    Vectors at the selected point

    projected into a shared 3D frame

    Surface normal

    N is always unit length
    N
    R = 2(N·L)N − L

    L points from the surface towards the light; V points towards the viewer. Select another point on the sphere to change N and see both dot products update.