top of page

DirectX 11 Lighting

Directional Light - All objects with the same shader applied are lit with the same direction and brightness. The brightness is a fraction calculated from the dot product of the direction of the light and the normal of a particular surface. If the direction vector of the light is normalised ( a unit vector ) it's magnitude will be one, therefore the dot product will result in the fraction cos(theta) where theta is the difference  in angle of the light and the normal to the face.
The surfaces also are coloured by a very dim ambient light, a base colour and brightness. This helps to define what would otherwise be pitch black surfaces. This is a cheep and easy method for lighting these surfaces that would otherwise only be lit by very expensive techniques such as ray tracing.

Point Light - A point light has a position and shines light in all directions. To calculate the light falling on a surface the position of the light is needed and a direction vector from the light source to the surface it is lighting.The brightness of a surface, similar to the directional light, is calculated by the dot product of the surface normal and the direction light vector.

Point Light with attenuation - Attenuation is calculated using an inverse square equation using constants for light fall-off and the distance of the surface from the light source. More information here.

Spot Light - Spot lights have an area of effect, often described as a cone. If the vertex in question is inside the spot light's area of effect it will be lit up. An article on implementing a spotlight.

Spot Light with attenuation - The spot light effect fades with distance.

bottom of page