Light-Surface Interaction - Rendering Equation, Light Sources, and Normal Vectors
Ever wondered why a 3D game character looks solid and real, while a flat drawing looks like paper? The secret is light. In computer graphics, illumination is what turns a lifeless collection of triangles into something that looks round, shiny, rough, metallic, or soft.
Imagine a world where every 3D object is just a shape floating in void no shadows, no highlights, no depth cues. A sphere would look like a flat circle. A teapot would look like a cardboard cutout. This is what 3D scenes look like without illumination.
Illumination the simulation of how light interacts with surfaces is the single most important factor that transforms wireframe geometry into believable, photorealistic imagery. It is the reason a shiny apple gleams under kitchen lights, the reason a matte wall absorbs light differently than a metal railing, and the reason we can perceive the curvature of a face in a video game.
Before we can build lighting models, we need to understand what actually happens when a photon of light hits a surface. This is the physical foundation upon which every shading technique is built.
What Happens When Light Hits a Surface?
When a ray of light strikes a surface, three things can happen:
- Absorption: The surface absorbs the light energy, converting it to heat. This is why black surfaces get warmer in sunlight.
- Reflection: The light bounces off the surface. This is what allows us to see objects.
- Transmission: The light passes through the surface (like glass or water), potentially bending (refraction).
For opaque objects (which is most of what we render in real-time graphics), we care primarily about reflection. And reflection itself splits into two fundamental categories:
- Diffuse reflection: Light scatters equally in all directions from the surface. This gives objects their base color (a red ball looks red from every angle).
- Specular reflection: Light reflects preferentially in the mirror direction. This creates shiny highlights (the bright spot on a glossy apple).
The Rendering Equation – The “Big Picture” of Light
The Rendering Equation, independently formalized by James Kajiya in 1986, is the mathematical crown jewel of illumination theory.
It describes, with physical correctness, the total amount of light leaving a point on a surface in a given direction.
Let’s decode every symbol with a student’s mind:
- – Outgoing radiance: The amount of light leaving point in the direction ωo (towards the camera, for instance).
- – Emitted radiance: Light the surface itself produces. For a light bulb it’s > 0, for a wall it’s 0.
- The integral – We sum over the whole hemisphere Ω above the surface. Every incoming direction potentially brings light.
- – The BRDF (Bidirectional Reflectance Distribution Function). It describes how light arriving from is reflected into . For a perfect mirror, it’s a single spike; for rough chalk, it spreads evenly.
- – Incoming radiance: Light arriving at from direction .
- – The Lambert cosine factor. Light arriving at a grazing angle illuminates a larger surface area, so its energy per unit area decreases.
Light Sources – The “Emitters” of Your Scene
In local illumination (the kind we’ll study in the next posts), we need to know the direction and colour of incoming light at each surface point. That depends on the type of light source.
1. Directional Light
- Concept: Parallel rays from an infinitely distant source.
- Parameters: only a direction vector L (constant everywhere) and a colour/intensity.
- Real-world analogy: The sun.
- Use: For outdoor scenes; cheap to compute.
Example:
Set L=(0.2,−1.0,0.3) (normalised to ≈(0.19,−0.95,0.28)). Every object in the scene receives light from exactly that direction.
2. Point Light (Omni Light)
- Concept: Light that radiates equally in all directions from a single point in space.
- Parameters: position Plight, colour, and an attenuation model.
Attenuation: Intensity decreases with distance. The classic formula is
where = distance from light to surface, and are constant, linear, and quadratic coefficients.
- Real-world analogy: A bare light bulb.
Example calculation:
Light at surface point at .
Direction: .
Distance metres. If attenuation constants are (1,0.09,0.032), attenuation . The light intensity is reduced to 16.6% at this point.
3. Spot Light
- Concept: A point light with a cone of influence.
- Parameters: position, direction , inner and outer cone angles (cut-off angles).
- Intensity: Full inside inner cone, falls off smoothly to zero at outer cone.
- Real-world analogy: Flashlight, stage spotlight.
Formula sketch:
Compute .
Then , clamped between 0 and 1.
4. Area Lights
Not typically covered in basic illumination models because they require integrating over the light’s surface (soft shadows).
In real-time, we often approximate them with multiple point samples or environment lighting.
Light Source Properties:
| Property | Description |
|---|---|
| Color | The spectral composition of the light (warm yellow, cool blue, etc.) |
| Intensity | How bright the light is (measured in candelas or arbitrary units) |
| Position | Where the light is located in 3D space (for point and spot lights) |
| Direction | The direction the light travels (for directional and spot lights) |
| Attenuation | How light intensity decreases with distance |
| Falloff | How light intensity decreases at the edges of a cone (spot lights) |
Normal Vectors – The Compass of a Surface
The normal vector (n) is a vector that points perpendicular to a surface at a given point. It is the single most important quantity in lighting, because the angle between the normal and the light direction determines how bright a surface appears.
- A surface facing the light directly → bright.
- A surface at a steep angle → dim.
- A surface facing away → dark.
Normals must always be normalized (length = 1) for lighting math to work correctly.
Every reflection calculation pivots on the surface normal, n. It’s the unit vector perpendicular to the surface at the point being shaded.
How to Compute a Triangle’s Normal
Given triangle vertices A, B, C:
Example:
A = (0, 0, 0), B = (1, 0, 0), C = (0, 1, 0).
u = (1, 0, 0), v = (0, 1, 0).
u×v = (0, 0, 1) → n = (0, 0, 1). Perfectly upward-facing.
Vertex Normals for Smooth Surfaces
To make a polygonal sphere appear smooth, we average the face normals of the triangles sharing a vertex, then normalise.
Transforming Normals
When you scale a model non-uniformly (e.g., stretch a sphere into an ellipsoid), the normals don’t remain perpendicular if you just apply the model matrix.
The correct transformation is the inverse transpose of the model matrix:
In shader code, if M only contains rotation and uniform scale, the regular model matrix works. But for shears and non-uniform scales, you need the special handling.
The normal determines the angle at which light strikes the surface (diffuse) and the direction of perfect reflection (specular). Light direction vectors, normal, and view vector together build every shading formula you’ll meet next.
Quick Exercise
A surface point at (2, 0, 2) has a normal (0, 1, 0). A point light sits at (2, 3, 0).
- Compute L.
- Find n⋅L.
- What does the dot product tell you about the brightness?
(Answer: . Dot product = 0.832. The surface receives 83.2% of the light’s energy compared to a perfectly facing surface.)
Was this article helpful?