BIT304 Computer Graphics

Computer GraphicsUnit 117 min read

Projection Techniques & Intensity Attenuation

Unit 11 of Computer Graphics explores parallel vs. perspective projections, their mathematical transformations, clipping and viewport mapping, and intensity attenuation (distance-based fading). It covers orthographic, isometric, and oblique projections, projection matrices, and real-world applications in 3D rendering,

TAKEAWAYS:

  • Parallel projections (orthographic, isometric, oblique) preserve parallel lines but distort angles/sizes; perspective projections mimic human vision with vanishing points and depth distortion.
  • Projection matrices (e.g., perspective divide) transform 3D coordinates into 2D screen space, requiring clipping (removing out-of-view objects) and viewport mapping (scaling to pixel coordinates).
  • Intensity attenuation models light fading with distance using inverse-square laws (e.g., for point lights) or linear falloff.
  • Real-world use: Games (e.g., Call of Duty’s depth-of-field) and apps (e.g., eSewa’s 3D product previews) rely on perspective projections; NTC’s traffic simulations use orthographic projections for overhead maps.
  • Exam focus: Derive projection matrices, differentiate projection types, and apply attenuation formulas to lighting scenarios.

1. Projection Techniques: Parallel vs. Perspective

1.1 Parallel Projections

Parallel projections project lines onto a plane while keeping them parallel. They do not converge to a vanishing point, so depth perception is lost but parallelism is preserved.

Types of Parallel Projections
  • Orthographic Projection:

    • Definition: Projects along lines perpendicular to the projection plane (like a shadow cast by a light directly above).
    • Use Case: Engineering drawings (e.g., NTC’s road network plans), CAD models.
    • Math: No perspective divide; scaling is uniform.
    • IMAGE: "orthographic projection example" | Orthographic projection of a cube (front, side, top views).
  • Isometric Projection:

    • Definition: A 2D representation of 3D objects with 120° angles between axes, preserving proportions.
    • Use Case: Daraz’s 3D product mockups (e.g., furniture layouts).
    • Math: Transformations:
    • IMAGE: "isometric projection cube" | Isometric cube with labeled axes.
  • Oblique Projection:

    • Definition: Projects at an angle (θ) to the projection plane, introducing shearing.
    • Types:
      • Cavalier: No foreshortening (θ = 45°).
      • Cabinet: Scales depth by 0.5 (realistic).
    • Use Case: Pathao’s driver app (tilted 3D maps for street views).
    • Math: Shearing transformation:
Worked Example: Orthographic Projection of a Triangle

Given: Triangle with vertices , , projected onto the XY-plane (ignore Z). Steps:

  1. Drop Z-coordinate: , , .
  2. Plot on 2D plane:
    
    

1.2 Perspective Projection

Perspective projections converge lines to a vanishing point, mimicking human vision. Depth is preserved but parallel lines diverge.

Types of Perspective Projections
  • One-Point Perspective:

    • Use Case: YouTube’s 3D video thumbnails (e.g., car commercials).
    • Math: Vanishing point at ; scaling factor , where is eye distance.
    • Example: A road disappearing into the horizon (like Nepal’s highway maps).
  • Two-Point Perspective:

    • Use Case: Google Maps’ 3D buildings (e.g., Kathmandu skyline).
    • Math: Two vanishing points (e.g., along X and Y axes).
Projection Matrix for Perspective

The perspective divide converts 3D to 2D using homogeneous coordinates:

  • Parameters:
    • : Near clipping plane.
    • : Far clipping plane.
    • : Distance to projection plane.
  • Final 2D coordinates: , .
Worked Example: Perspective Projection of a Point

Given: Point with , , . Steps:

  1. Apply matrix:
  2. Divide by : , .
  3. Result: .

2. Clipping and Viewport Mapping

2.1 Clipping Algorithms

Remove objects outside the view frustum (visible volume). Common algorithms:

  • Cohen-Sutherland: Divides space into 9 regions (inside/outside).
  • Liang-Barsky: Parametric clipping for lines.
Cohen-Sutherland Regions

Worked Example: Clipping a Line Segment Given: Line from to with viewport . Steps:

  1. Compute bit codes:
    • : 0010 (bottom).
    • : 0000 (inside).
  2. Truncate to (bottom edge): .
  3. Result: Clipped line from to .

2.2 Viewport Transformation

Maps clipped coordinates to pixel space using: Example: For viewport and :


3. Intensity Attenuation

Light intensity decreases with distance. Models:

  1. Inverse Square Law (point lights):
  2. Linear Attenuation (spotlights):
  3. Combined:
Worked Example: Attenuation in a Game

Scenario: A Ncell tower’s signal weakens with distance.

  • (max intensity at ).
  • (quadratic falloff).
  • At km: I = \frac{100}{0.01 \times 25} = 40 \text{ (40% signal strength)}

In the Real World

  1. eSewa’s 3D Product Previews: Uses orthographic projections for flat product images (e.g., mobile phones) and perspective projections for 3D views (e.g., furniture). The projection matrix converts 3D models to 2D screens.

  2. Pathao’s Driver Navigation: Employs oblique projections to show tilted street views, helping drivers judge distances. Intensity attenuation simulates foggy conditions (e.g., reduced visibility at night).

  3. Nepal Stock Exchange (NEPSE) Charts: Uses isometric projections for 3D stock trend visualizations. Clipping hides outdated data outside the visible timeframe.


Exam Tip

  1. Projection Types:

    • Parallel: No vanishing point (e.g., CAD drawings).
    • Perspective: Vanishing point (e.g., photos).
    • Matrix Math: Always show the perspective divide step.
  2. Attenuation:

    • Memorize the inverse square law formula.
    • For exams, assume unless given.
  3. Clipping:

    • Cohen-Sutherland uses bitwise AND to check visibility.
    • Liang-Barsky is faster for lines.
  4. Viewport Mapping:

    • Scale coordinates to pixel dimensions (e.g., 1920×1080).

Practice: Derive the projection matrix for a given and , then clip a line segment using Cohen-Sutherland.

Based on the TU BIT syllabus for Computer Graphics (BIT304), unit 11.

Discussion

Loading…