📘 Triangle Rasterization — Exam Notes (Computer Graphics)
🔹 1. Introduction
Triangle Rasterization is the process of converting a triangle (defined by 3 vertices in 2D/3D space) into a set of pixels on the screen.
👉 In simple words:
It decides which pixels inside a triangle should be colored to display it on a raster screen.
🔹 2. Why Triangles?
Triangles are used because:
- Always planar (flat surface)
- Simple mathematical processing
- Efficient for GPUs
- Basis of all 3D models (triangle mesh)
🔹 3. Basic Idea of Rasterization
Given triangle vertices:
[
A(x_1,y_1),; B(x_2,y_2),; C(x_3,y_3)
]
👉 Goal:
- Fill all pixels inside the triangle boundary
🔹 4. Steps in Triangle Rasterization
✔️ Step 1: Find Bounding Box
- Determine smallest rectangle covering triangle:
[
x_{min}, x_{max}, y_{min}, y_{max}
]
👉 Only pixels inside this box are checked.
✔️ Step 2: Scan Each Pixel
- Check every pixel inside bounding box
✔️ Step 3: Inside-Outside Test
- Decide whether pixel lies inside triangle
✔️ Step 4: Color Pixel
- If inside → fill pixel
- If outside → ignore
🔹 5. Methods of Triangle Rasterization
🔸 5.1 Edge Function Method (Very Important)
✔️ Concept
A point is inside triangle if it is on the same side of all edges.
✔️ Edge Equation
For edge between two points:
[
E(x,y) = Ax + By + C
]
✔️ Rule
For triangle ABC:
✔️ Advantages
- Fast
- Used in GPUs
- Easy parallelization
🔸 5.2 Barycentric Coordinate Method
✔️ Concept
Any point inside triangle can be written as:
[
P = \alpha A + \beta B + \gamma C
]
Where:
- (\alpha + \beta + \gamma = 1)
✔️ Inside Condition
Point is inside if:
[
0 \le \alpha, \beta, \gamma \le 1
]
✔️ Advantages
- Used for interpolation (color, texture, depth)
- Very accurate
🔸 5.3 Scan Line Algorithm
✔️ Concept
- Draw horizontal lines (scan lines)
- Find intersection points with triangle edges
- Fill pixels between intersections
✔️ Steps
- For each scan line (row):
- Find intersection with triangle edges
- Sort intersection points
- Fill pixels between pairs
✔️ Advantage
- Efficient for filled polygons
🔹 6. Pixel Coverage Concept
- Each pixel has a center point
- If center lies inside triangle → pixel is filled
🔹 7. Important Tests (Inside Triangle)
✔️ 7.1 Area Method
Idea:
If point is inside triangle:
[
Area(ABC) = Area(PBC) + Area(APC) + Area(ABP)
]
✔️ 7.2 Sign Method
- Check orientation using cross product
- Same sign → inside
🔹 8. Interpolation (Important in Graphics)
Used to calculate:
Using barycentric coordinates.
🔹 9. Applications
- 3D rendering
- Games
- Animation
- GPU pipelines
- CAD systems
🔹 10. Advantages
- Efficient rendering
- Works well with hardware (GPU)
- Forms basis of real-time graphics
🔹 11. Limitations
- Large number of pixels to process
- Requires optimization for real-time rendering
🔹 12. Diagram Descriptions
✔️ Triangle Rasterization Grid
- Draw triangle on pixel grid
- Show filled pixels inside
✔️ Bounding Box
- Rectangle surrounding triangle
✔️ Scan Lines
- Horizontal lines filling triangle
✔️ Edge Test
- Show pixel checked against triangle edges
📝 Likely Exam Questions
- Define triangle rasterization.
- Why are triangles used in graphics?
- Explain bounding box method.
- What is edge function method?
- Explain barycentric coordinates.
- Describe scan line algorithm.
- How do you determine if a point lies inside a triangle?
- What is pixel coverage?
- Explain interpolation in rasterization.
- Compare different rasterization methods.
⚡ Quick Revision Summary