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 has
It 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, giving
The 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 is
where 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.
Let the oriented vertices be , in an order such that points out of the front face. The given nondegeneracy guarantees . A ray with nonzero direction approaches the front face only if
Reject . This combines back-face culling with rejection of parallel rays, including the coplanar case for this ordinary surface-hit test. The ray-plane intersection parameter is
Reject ; for rays launched from existing surfaces use a positive lower cutoff to avoid counting the launch surface. Form .
Finally determine whether lies inside the triangle. For , , , compute
These solve . The barycentric coordinates are , so the complete acceptance criterion is
The inequalities include the edges and vertices. A renderer sharing edges between triangles should use a consistent numerical edge convention; small floating-point arithmetic errors near a shared boundary should not create cracks. Normalizing is unnecessary for this intersection calculation because its scale cancels.
At each primary hit , send a shadow ray toward each point light. An especially clear parameterization is
If an opaque scene surface intersects this open segment, the source is hidden. The finite interval is essential: an object beyond the light must not cast a shadow at . Exclude the launch surface with a small geometrically appropriate origin offset or positive minimum parameter, so floating-point arithmetic does not create a false self-intersection.
Introduce a visibility factor equal to zero when blocked and one otherwise. The modified equation is
A blocked light loses both its diffuse and specular contributions. The simple ambient approximation remains. Opaque point lights produce hard shadow boundaries. Use a consistent sidedness policy for occluders: an opaque closed solid blocks from either crossing side, so a two-sided blocker test is appropriate even when primary visibility uses back-face culling. An any-hit query can stop as soon as it finds one blocker before the light.
Ray-triangle intersection 2026-10-31
A ray-plane intersection followed by an inside-triangle test, conveniently using nonnegative barycentric coordinates. Oriented surfaces may additionally require a front-facing hit through back-face culling.