Shading Study Guide
Study Guide
📖 Core Concepts
Shading – Varies darkness to give a 3‑D model depth; approximates how light interacts locally with a surface.
Shader – Small program that computes a surface’s final color based on lighting, view direction, and material properties (e.g., BRDF).
Flat Shading – One lighting value per polygon, derived from the polygon’s face normal; uniform color across the face.
Smooth Shading – Lighting values are computed per vertex and then interpolated across the polygon for gradual transitions.
Gouraud Shading – Compute intensity at each vertex, then interpolate the intensity across the face.
Phong Shading – Interpolate vertex normals across the face, renormalize, then compute intensity per pixel → accurate specular highlights.
Lighting Types – Ambient, Directional, Point, Spotlight, Area. Each differs in source geometry and whether intensity falls off with distance.
Distance Falloff – Light intensity diminishes with distance; common models are none ($n=0$), linear ($n=1$), and quadratic ($n=2$).
Deferred Shading – Two‑pass pipeline: first store per‑pixel data (normals, depth, material) in G‑buffers; second pass evaluates lighting using that data only for visible fragments.
---
📌 Must Remember
Flat vs. Smooth – Flat = one normal per face; Smooth = one normal per vertex.
Gouraud → fast, but can miss specular peaks on large triangles.
Phong → slower, but specular highlights are correct everywhere.
Quadratic falloff ($I \propto \frac{1}{x^{2}}$) matches real‑world free‑space attenuation.
Directional light has no distance falloff (source at infinity).
Ambient light is constant, direction‑independent, and adds a base illumination.
Deferred shading reduces redundant lighting calculations for fragments that are later discarded (e.g., hidden by depth test).
---
🔄 Key Processes
Flat Shading Pipeline
Compute face normal.
Evaluate lighting model once (often at first vertex or centroid).
Apply resulting color uniformly to the whole polygon.
Gouraud Shading Pipeline
For each vertex:
Compute vertex normal (usually averaged from adjacent faces).
Apply illumination model → vertex intensity.
Rasterize triangle; bilinearly interpolate vertex intensities to each pixel.
Phong Shading Pipeline
For each vertex: store vertex normal.
During rasterization:
Interpolate normals across the triangle (barycentric interpolation).
Renormalize the interpolated normal.
Apply illumination model per pixel → final color.
Deferred Shading Passes
Geometry Pass: Render scene geometry, output G‑buffer (depth, world‑space normal, albedo, material parameters).
Lighting Pass: For each light, read G‑buffer, compute lighting per pixel, accumulate to final image.
Distance Falloff Computation
Compute distance $x$ between surface point and light position.
Choose falloff exponent $n$ (0, 1, 2).
Light intensity $I = \frac{I0}{x^{\,n}}$ (where $I0$ is the light’s base intensity).
---
🔍 Key Comparisons
Flat Shading vs. Smooth Shading
Flat: one normal per face → hard edges, no specular detail.
Smooth: per‑vertex normals → gradual shading, realistic highlights.
Gouraud vs. Phong
Gouraud: interpolates intensity → fast, may miss specular peaks.
Phong: interpolates normals → slower, accurate specular highlights everywhere.
Ambient vs. Directional Lighting
Ambient: uniform, no direction, no falloff.
Directional: uniform direction, no distance attenuation, simulates distant sun.
Point Light vs. Spotlight
Point: radiates equally in all directions.
Spotlight: radiates within a cone; intensity often falls off toward edges.
Deferred Shading vs. Forward Shading
Deferred: lighting evaluated after geometry, efficient with many lights.
Forward: lighting computed while drawing each object, can become costly with many lights.
---
⚠️ Common Misunderstandings
“Flat shading ignores lighting” – It still computes lighting, just once per face.
“Gouraud shading gives the same result as Phong” – Only when triangles are tiny; otherwise specular highlights differ.
“Distance falloff always uses $1/x^2$” – In real‑time graphics, linear or no falloff is often used for artistic control or performance.
“Ambient light is the same as ambient occlusion” – Ambient lighting is a constant term; ambient occlusion modulates it based on geometry occlusion.
“Deferred shading eliminates all overdraw” – It removes redundant lighting calculations but still incurs geometry overdraw and G‑buffer bandwidth costs.
---
🧠 Mental Models / Intuition
Flat shading = painting the whole polygon with one brushstroke.
Smooth shading = blending colors from the polygon’s corners toward the center.
Gouraud = “shade the corners, then blend the shades.”
Phong = “blend the normals, then shade each pixel.”
Distance falloff = dimming a flashlight the farther you walk from it; quadratic is “real light,” linear is “artist‑friendly.”
Deferred shading = first capture a “photograph” of all surface properties, then “light the photo” in a separate step.
---
🚩 Exceptions & Edge Cases
Specular highlights in flat shading are usually omitted because a single normal cannot represent a varying highlight across the face.
Gouraud shading fails on large triangles with high curvature where vertex normals differ greatly.
Phong shading requires normal renormalization after interpolation; skipping this yields shading artifacts.
Spotlights often include an inner/outer cone cutoff; outside the outer cone intensity = 0.
Directional lights ignore distance falloff, but some engines allow an artificial attenuation for artistic reasons.
---
📍 When to Use Which
Flat Shading – low‑poly models, performance‑critical contexts, or stylized “low‑poly” aesthetics.
Gouraud Shading – real‑time apps with many vertices where specular accuracy is less critical (e.g., mobile games).
Phong Shading – when accurate specular highlights are needed (high‑quality desktop rendering).
Linear Falloff – artistic control, to avoid harsh darkening at moderate distances.
Quadratic Falloff – physically‑based rendering, outdoor scenes with point/spot lights.
Deferred Shading – scenes with dozens of dynamic lights; limited by memory bandwidth and lack of MSAA (multisample anti‑aliasing).
Forward Shading – transparent objects, multi‑sample anti‑aliasing, or when G‑buffer size is a bottleneck.
---
👀 Patterns to Recognize
Uniform color across a polygon → flat shading was used.
Smooth gradient but missing specular on large triangles → likely Gouraud shading.
Sharp, correctly placed highlights on any surface orientation → Phong shading.
Lighting intensity that does not diminish with distance → either directional light or “none” falloff.
Multiple lights affecting a scene without per‑object shader changes → deferred shading pipeline.
---
🗂️ Exam Traps
“Flat shading includes per‑pixel specular highlights.” – Wrong; specular is omitted or inaccurate.
Choosing “quadratic falloff” for a directional light. – Directional lights have no distance, so falloff is irrelevant.
Assuming Gouraud shading always produces the same visual result as Phong for any triangle size. – Only true for very small triangles.
Confusing ambient light with ambient occlusion. – Ambient is a constant term; AO modulates it based on geometry.
Selecting deferred shading as the answer for “best for transparent objects.” – Deferred shading struggles with transparency; forward shading is preferred.
---
or
Or, immediately create your own study flashcards:
Upload a PDF.
Master Study Materials.
Master Study Materials.
Start learning in seconds
Drop your PDFs here or
or