Skip to content
CoreSource checked

Cook-Torrance Shading

Models specular reflection using microfacet surface behavior.

Quick Facts

Compact metadata for implementation and discovery.

Category
Rendering
Difficulty
Advanced
Family
Physically Based Shading
Tier
Core
Status
Verified
Review
Source Checked
Sources
2
Formulas
1
Relationships
4
Code example
Ready
Visualization
Ready

Overview

Cook-Torrance shading combines normal distribution, geometry, and Fresnel terms to approximate physically based specular highlights.

Core Concepts

microfacet modelfresnel termnormal distributiongeometry term

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(1)

Average

O(pixels * lights)

Worst

O(pixels * lights)

Space

O(1)

When to Use

  • Use when real-time graphics needs microfacet model.
  • Use when the input matches the assumptions behind physically Based Shading.

When Not to Use

  • Avoid when the effect costs more than the visual improvement for the target hardware.
  • Avoid when a simpler algorithm gives the required result with less setup.

What It Does

  • Models specular reflection using microfacet surface behavior
  • Uses microfacet model and fresnel term to guide the work.
  • Produces rendered image.

Use Cases

  • Real-time graphics
  • Offline rendering
  • Lighting and visibility effects

Inputs

  • Scene geometry
  • Materials
  • Camera and lighting state

Outputs

  • Rendered image
  • Visibility or shading buffers

Key Formulas (1)

Cook-Torrance BRDF

f = D · F · G / (4 · NdotL · NdotV)
f = D * F * G / (4 * NdotL * NdotV)

Combines microfacet distribution, Fresnel, and masking-shadowing terms.

Pseudocode

  1. 1.Prepare the inputs and state needed for Cook-Torrance Shading.
  2. 2.Apply the microfacet model step while the stopping condition has not been met.
  3. 3.Update intermediate state and discard invalid candidates.
  4. 4.Return rendered image.

Canonical Example

Input
surface normal, light direction, view direction, roughness, and metallic value
Output
physically based specular lighting contribution
Explanation
The model combines microfacet distribution, geometry, and Fresnel terms to estimate reflected light.

Implementation Notes

  • Evaluate distribution, geometry, and Fresnel terms consistently.
  • Clamp dot products to valid ranges.
  • Keep energy conservation and color-space conversion explicit.

Common Pitfalls

  • Using unnormalized normal, light, or view vectors.
  • Mixing color-space conventions for material parameters.
  • Treating roughness and specular terms as independent of the chosen BRDF convention.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Show rays, samples, buffers, or shading terms that contribute to the final pixel.

Cook-Torrance Shading mechanism walkthrough step 1 of 4
Step 1 of 4: Prepare the inputs and state needed for Cook-Torrance Shading.
rendering-mechanism

Notes

Cook-Torrance shading is a microfacet model; practical results depend on chosen D, F, and G terms.

Sources (2)

What each reference supports for this entry.

Cook-Torrance paper

Paper

Original ACM Transactions on Graphics paper for the Cook-Torrance reflectance model.

Open source

Physically Based Rendering

Book

Online book reference for ray tracing, path tracing, sampling, BRDFs, and rendering implementation.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Alternative toBlinn-Phong Shading

Cook-Torrance is a physically based alternative to classic empirical specular models.

Often paired withImportance Sampling BRDF

Physically based BRDFs are often importance sampled in renderers.

Tags

GraphicsBRDFShadingLighting