Computer Graphics Lecture: Perspective, Clipping, and View Volumes

Perspective vs Parallel Projection

  • Perspective projection uses a single center of projection (COP/PRP) and a view frustum (pyramid-like). The image forms on a projection plane; points outside are clipped by planes near/far and by left/right/top/bottom limits.

  • Parallel projection uses a fixed direction for projection; the view volume is a axis-aligned cuboid (commonly 2×2×1 or similar) and there is no perspective foreshortening.

  • Key planes:

    • Front clipping plane (near)

    • Back clipping plane (far)

    • Projection plane (view plane) where the image is formed

    • Left, Right, Top, Bottom planes defining the cuboid/frustum

  • View volume parameters (example):

    • Near, Far: distances along the view direction, often denoted as N<em>minN<em>{min} and N</em>maxN</em>{max} or similar

    • For perspective, the volume is a frustum bounded by six planes; for parallel, it’s a cuboid

  • Coordinate systems: world coordinates vs camera (view) coordinates; a sequence of transforms aligns world to the camera frame

  • In practice, all such transforms can be represented as matrices and composed into a single projection matrix

The 7-step projection pipeline (world space to clip space)

  • Step 1: Define camera frame from VRP (View Reference Point) and VUP (Up vector) to establish camera axes

  • Step 2: Build world-to-camera transform (rotate around axes and translate) so that objects are expressed in camera coordinates

  • Step 3: Translate so COP (Projection Reference Point) is at the origin and align orientation

  • Step 4: Specify the view volume: near/far clipping planes and the projection plane; identify left/right/top/bottom limits

  • Step 5: Apply projection geometry: for perspective, project from COP through points to the projection plane; for parallel, project with parallel lines

  • Step 6: Canonical volume normalization: apply shear/scale to make the view volume a convenient canonical form (e.g., 45° formatting and unit depth) so clipping is easier

  • Step 7: Assemble the final projection matrix by multiplying the individual transforms into a single composite matrix P=M<em>7M</em>6M1P = M<em>7 M</em>6 \cdots M_1 and apply to all vertices

Perspective vs. parallel: view volumes and planes

  • Perspective: view frustum; projection is from a single point through the projection plane; near/far planes along the viewing direction bound the frustum

  • Parallel: view volume is a cuboid; projection rays are parallel; clipping planes are parallel to each other

  • Clipping planes involved: front (near) plane, back (far) plane, left, right, top, bottom planes

  • The projection plane (view plane) is where the resulting image is formed; mathematically it can be positioned anywhere relative to the COP, even behind the camera in pure math

Clipping and viewing volume clipping (Cohen–Sutherland style concepts)

  • Clipping tests separate inside vs outside points relative to the view volume

  • For 2D (window) clipping: use 4 region codes (top, bottom, left, right)

    • Trivial accept: if both endpoints have code 0000

    • Trivial reject: if bitwise AND of codes != 0

    • Otherwise, compute intersections with the window edges and continue

  • For 3D (view frustum) clipping: extend to 6 region tests (top, bottom, left, right, near/front, far/back)

    • Outcodes: 6-bit codes; use the same logic as 2D to prune or clip

    • Intersection with planes: compute line-plane intersections to replace clipped endpoints

  • Practical note: after clipping, endpoints are tested against all six planes to determine accept/reject

  • In practice, clipping may be done in a staged way or via a composite matrix followed by post-clip checks

Outcodes and quick rejection (Cohen–Sutherland intuition)

  • Assign a 6-bit outcode to each endpoint corresponding to: {Top, Bottom, Left, Right, Near, Far}

  • Rules:

    • If (code1 OR code2) == 0: trivially accept (both inside)

    • If (code1 AND code2) != 0: trivially reject (both outside on the same side)

    • Otherwise, compute the intersection with one of the clipping planes and update the endpoint, then re-evaluate

  • In 2D, oil the logic with 4-bit codes; in 3D, extend to 6-bit codes; the same principle applies

  • Codes help reject the vast majority of geometry in real-time rendering (often > 99% of geometry is outside the view)

From world space to clip space: a compact pipeline sketch

  • World coordinates → camera (view) coordinates via rotation and translation

  • Move COP to origin and define projection geometry

  • Perspective or parallel projection to project onto projection/view plane

  • Canonicalization to a standard volume (to simplify clipping math)

  • Compute the composite projection matrix by multiplying all steps into one matrix

  • Apply the composite matrix to all vertices to obtain clip coordinates

  • Clip against the canonical volume, then map to window/viewports

A few practical notes and terminology from the lecture

  • When describing cameras, people may use different conventions (right-handed vs left-handed, which axis is X/Y/Z, etc.). The key is consistency across your pipeline

  • Indexing and plane equations often appear in forms like Ax + By + Cz + D = 0; clipping requires planes in standard form

  • Canonical volume tricks (e.g., making depth range to 1, enforcing 45° geometry) simplify downstream clipping and math

  • Window-to-viewport mapping is a separate step/document, but you should be aware that after clipping you map normalized device coordinates to the final screen coordinates

  • In code, you usually compute a single composite matrix P by multiplying all step matrices in the right order and then apply P to all points, followed by clipping

Quick reference formulas (illustrative, common conventions)

  • Perspective projection from camera coordinates (COP at origin, projection plane at distance dd along the z-axis):
    x=xdz,y=ydz,x' = x \frac{d}{z}, \quad y' = y \frac{d}{z},
    with the projected depth encoded via the perspective divide by zz. The exact plane placement and signs depend on your coordinate convention

  • Canonical view volume for normalized device coordinates (NDC):

    • In OpenGL style: x<em>ndc,y</em>ndc[1,1],  zndc[1,1]x<em>{ndc}, y</em>{ndc} \in [-1, 1], \; z_{ndc} \in [-1, 1] after perspective divide

    • In DirectX style: zndc[0,1]z_{ndc} \in [0, 1] after perspective divide

  • Clip planes in standard form: for a plane with normal n=(a,b,c)\mathbf{n} = (a,b,c) and offset dd, a point p=(x,y,z)\mathbf{p}=(x,y,z) is on the plane if ax+by+cz+d=0a x + b y + c z + d = 0; a line segment between two points is clipped by substituting the parametric point into the plane equation to solve for the intersection parameter tt:
    p(t)=p<em>0+t(p</em>1p<em>0),t=np</em>0+dn(p<em>1p</em>0)\mathbf{p}(t) = \mathbf{p}<em>0 + t(\mathbf{p}</em>1 - \mathbf{p}<em>0), \quad t = -\frac{\mathbf{n}\cdot\mathbf{p}</em>0 + d}{\mathbf{n}\cdot(\mathbf{p}<em>1-\mathbf{p}</em>0)}
    then replace the outside endpoint with the intersection point and continue

What to remember for last-minute review

  • The projection pipeline consists of camera setup, world-to-camera transform, COP positioning, clipping geometry, projection (perspective or parallel), canonical normalization, and final window mapping

  • The seven-step narrative emphasizes: define camera frame, transform coordinates, place COP, define clip volume, project, canonicalize, and compose the final matrix

  • Clipping is essential: you never render geometry outside the view volume; Cohen–Sutherland style outcodes enable fast rejection and efficient clipping

  • Practice identifying the six clip planes and writing the plane equations for common canonical volumes (top, bottom, left, right, near, far) and verify point inclusion against those planes