Interpret the given focal point as the centre of perspective projection, . First translate it to the origin with . The direction from to the world origin is then , of length 10. Choose the rotation matrix so that this direction becomes :
Indeed, the transformed component is , and the transformed component is . Thus the required mapping, followed by the perspective divide, is
For a world point , its camera coordinates and projected device coordinates are
The world origin projects to and lies at camera depth 10. A point five units along the unit viewing direction from has camera coordinates , so it lies on the central image plane as expected. Here device coordinates are image-plane coordinates centred on the optical axis; an actual pixel viewport would require its own specified scale and offset.
Only rotations about the -axis are available. Consequently the camera's horizontal axis stays parallel to the world -axis; the viewing direction lies in the world plane. The available orientation has pitch but no independent yaw or roll. Translations move the camera and the projected origin but cannot supply the missing orientation degrees of freedom.
Represent a point by the column of homogeneous coordinates . The actions of the four matrices are:
MatrixGeometric action and parameters
A proper rotation about the -axis: . The angle is in radians, with the usual right-hand sense.
A translation by : .
Uniform scaling by : . Positive gives a uniform dilation; collapses the object to the origin; negative additionally reverses its direction through the origin.
Perspective projection from the origin onto the plane , where is the focal length in the chosen coordinate units.
The last operation produces . It requires a perspective divide: divide the first three components by the last. For ,
This is why the last component of homogeneous coordinates cannot simply be discarded. Points with have no finite projected position, and a visible scene normally uses under this forward-axis convention. The first three transformations leave the last component equal to one and need no nontrivial divide. The displayed retains no depth variation after division; it describes projection onto the image plane, rather than a complete depth-buffer mapping.
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.
Perspective divide 2026-10-31
Conversion of a transformed column of homogeneous coordinates with to . This is the nonlinear step in an otherwise matrix-based perspective projection pipeline.