Light, Materials, and BRDFs

Light, Materials, and BRDFs

An intersection routine establishes the point at which a path meets a surface, but it does not determine the radiance recorded by the camera. That task belongs to the material model, which describes how incident light is scattered from the surface toward an outgoing direction. Rendering systems often fail in this transition because geometric quantities are correct in isolation while their directional conventions are inconsistent during shading.

For an initial implementation, direct illumination provides the appropriate scope: a light is sampled, its visibility is tested, and its contribution toward the camera is evaluated. Indirect illumination belongs to the more general transport estimator discussed later, and introducing it before normals, shadow rays, and color transforms are stable makes a local error difficult to isolate.

Diffuse lobe and glossy lobe around a surface

A diffuse BRDF distributes reflected energy broadly across the hemisphere, whereas a glossy BRDF concentrates it around the ideal reflection direction.

Surface data and directional conventions

A shading record should at minimum provide a surface position $\mathbf{p}$, a unit geometric or shading normal $\mathbf{n}$, an outgoing direction $\boldsymbol{\omega}_o$ toward the preceding path vertex or camera, material parameters, and texture coordinates where appropriate. For a point light, the incoming direction and distance follow from

to_light = light_pos - p
distance = |to_light|
wi = to_light / distance
cos_theta = max(0, dot(n, wi))

The cosine term is zero whenever the sampled light is below the local tangent plane, and therefore no direct contribution should be admitted from that side of an opaque surface. The convention for whether a direction points toward or away from a surface must be selected once and applied throughout the material and light interfaces; mixing conventions is a common source of apparently inexplicable negative contributions.

Lambertian diffuse reflection

For a Lambertian material with linear albedo $a$, the BRDF is constant over the visible hemisphere:

$$ f_r=\frac{a}{\pi}. $$

A direct estimate for a point light of intensity $I$, at distance $r$, is

$$ L=\frac{a}{\pi},I,\frac{\max(0,\mathbf{n}\cdot\boldsymbol{\omega}_i)}{r^2}. $$

The factor of $\pi$ is not an aesthetic normalization but a consequence of energy conservation over the hemisphere. Omitting it causes nominally white diffuse surfaces to reflect more energy than they receive, an error that becomes especially obvious once indirect transport is introduced. Albedo values must likewise be decoded to linear space before this calculation; display-encoded texture values are not suitable operands for the BRDF.

Specular response and the reflection equation

An ideal mirror reflects into one direction, conventionally written as reflect(incident, normal). Glossy materials replace that single direction with a lobe of finite width around it. Although Blinn-Phong remains useful for illustrating the relationship between surface orientation and a highlight, microfacet BRDFs provide the more durable model for physically based transport because they describe distribution, masking, and Fresnel behavior separately.

The general relationship between incoming radiance and outgoing radiance is expressed by the reflection equation:

$$ L_o(\boldsymbol{\omega}o)=\int{\mathcal{H}}f_r(\boldsymbol{\omega}_i,\boldsymbol{\omega}_o),L_i(\boldsymbol{\omega}_i),(\mathbf{n}\cdot\boldsymbol{\omega}_i),d\boldsymbol{\omega}_i. $$

Direct lighting approximates this integral by sampling light sources, while path tracing approximates it by recursively sampling directions over the hemisphere. The underlying equation is unchanged; only the estimator differs.

Visibility, textures, and interfaces

A sampled light whose shadow ray is occluded contributes zero, which makes shadows an integral part of lighting rather than a separate decorative effect. Hard shadows from a point light require a single visibility query bounded by the distance to the light; soft shadows result from applying the same construction to many samples across an area emitter.

Texture color spaces also require explicit handling. Albedo maps are normally stored as sRGB and must be decoded before BRDF evaluation, whereas roughness, metalness, and most masks are typically stored as linear data. If every material appears chalky, overly dark, or unexpectedly saturated, the color transforms should be inspected before changing the scattering model.

A useful minimum material interface separates sampling from evaluation:

sample(wo, n, rng) -> wi, pdf, f, specular_flag
evaluate(wo, wi, n) -> f
emit() -> radiance or black

The sample operation proposes a continuation direction and returns the probability density required to weight it correctly. The evaluate operation is needed when another strategy, such as light sampling, selects the direction first. Ideal mirrors evaluate to zero for almost every direction, which is why a practical integrator cannot rely on light sampling alone for specular transport.

A hard-shadowed Lambertian sphere rendered from verified normals is a modest example, but it establishes the material, visibility, and color-space contracts on which more elaborate BRDFs depend.