Bui Tuong Phong 2026-10-31
In the solid-modelling convention used here, a rigid-body transformation is an orientation-preserving rigid transformation, represented by a proper rotation and a translation. The proposed upper-left block is orthogonal but hasIt is a reflection in the plane . It preserves distances, but reverses handedness, so it cannot describe continuous motion of a rigid solid through proper rotations and translations. Some mathematical uses of rigid transformation include this orientation-reversing case; the determinant is the distinction relevant to the warning.
In a solid modeller, triangle winding and outward normal vectors must agree. A reflection reverses the winding: for edge vectors ,Simply transforming stored normal vectors by while retaining the original vertex order therefore makes the geometric and stored normals disagree. Back-face culling, inside/outside tests and Phong reflection model calculations can then use the wrong side. Code assuming a positive oriented volume can likewise interpret the reflected solid incorrectly. A modeller can support reflections if it deliberately corrects these orientation conventions.
A suitable alternative rotates by about and then translates upward by
height. Writing ,Its rotation matrix has determinant . The source bounds , , become , , , where . A horizontal stripe becomes the vertical stripe , so even the stripe positions from the left edge are preserved. The face's normal vector is also preserved.At a surface point , let be the outward unit normal vector, the unit vector from toward the viewer, and the unit vector from toward the light. The incoming propagation direction is therefore . The specular reflection direction points away from the surface along the ideal reflected ray.
Resolve into its normal and tangential components:Reflection of the incoming direction preserves its tangential component and reverses its normal component. Equivalently, the outgoing direction has the same normal component as and the opposite tangential component, givingThe dot product identity shows when .
In the Phong reflection model, ambient lighting approximates unmodelled indirect illumination and is independent of these directions. The diffuse term models Lambertian reflectance and varies as . The specular term models a highlight around and varies as , where controls its sharpness. For a visible front surface, a convenient per-colour-channel equation iswhere is ambient illumination, is the source strength at the surface including any chosen attenuation, are material weights, and is one when and zero otherwise. The weights can be colour-dependent. An idealized point source's incident strength decreases as inverse distance squared; the empirical equation can also use a prescribed attenuation law.
In degenerate geometric cases the effective weights switch off. A light behind or tangent to the surface contributes neither direct diffuse nor specular illumination. If , the specular term is zero. A viewpoint on the back side is rejected by back-face culling for a one-sided surface. A material with no highlight has ; with no diffuse response, ; without ambient illumination the ambient term vanishes. These zeros do not require renormalizing the other weights, and the empirical Phong reflection model does not impose a universal condition . At coincident light/surface or eye/surface positions a direction cannot be normalized; such singular configurations require a separate convention, rather than substituting an undefined unit vector into the formula.
A bidirectional reflectance distribution function, or BRDF, describes how a surface scatters incident illumination into each outgoing direction. At a fixed surface point and wavelength, its inputs are two directions above the surface, toward the incident source and toward the observer; equivalently these are two pairs of angular coordinates. Its output is the ratio of differential reflected radiance to differential incident irradiance:Position and wavelength may be additional arguments when material properties vary. A colour implementation can return one value per colour channel. The BRDF is a material response, not the final outgoing light value: it must be combined with the incident illumination and the projected-angle factor.[ref]
Physically Based Rendering: From Theory to Implementation (4th edition) by Matt Pharr and others. §4.3.1, definition of the BRDF as differential outgoing radiance divided by differential incident irradiance
For incident radiance , the reflection part of the rendering equation isEmission is added separately if the surface itself emits. This integral explains how a BRDF replaces the assumed material response of a local lighting model. For Lambertian reflectance, , so the cosine factor yields the diffuse term from part (a). A directional specular lobe supplies a highlight. The empirical Phong reflection model is an approximate angular-response model of this kind; its original direct specular term is not automatically a normalized, energy-conserving BRDF. The ambient term approximates missing illumination and is not itself a third direction-independent material scattering mechanism. More general BRDFs can reproduce measured surface behaviour, while illumination from other surfaces supplies indirect light in the rendering equation.
For single-shot ray tracing, construct one primary ray per pixel, normally through its centre on the image plane, with the camera centre as origin for perspective projection. Transform the ray into the scene's coordinates, or consistently transform all the scene geometry into camera coordinates.
Intersect that primary ray with the scene's triangles, using part (c), and retain the accepted hit with the smallest nonnegative parameter . This nearest-hit selection supplies visibility: farther surfaces cannot show through the first opaque surface. If there is no hit, write the background colour. At a hit , obtain its material colour and front unit normal vector and set toward the camera.
For each point light at , form , calculate the specular reflection direction, and evaluate its diffuse and specular contributions using the Phong reflection model. Sum the contributions and add ambient illumination once:The coloured surface can supply colour-dependent diffuse weights, and each source can have its own colour. Convert the result into the output image's colour encoding and range. Single-shot here means direct local shading after one primary visibility ray; no reflected or transmitted secondary viewing rays are followed. Part (e) adds secondary visibility queries for the lights.