Title: Computer Graphics Shading Models
1Computer Graphics- Shading Models -
2Overview
- So far
- Ray tracing 101
- Today
- Recursive Ray Tracing
- Physical Quantities in Rendering
- Shading
- Empirical BRDF models
3Recap Fundamental Ray Tracing Steps
- Primary ray generation
- Rays from viewpoint along viewing directions into
3D scene - (At least) one ray per picture element (pixel)
- Ray tracing
- Intersection of primary ray with scene geometry
- Intersected object and intersection coordinates
on object - Shading
- From intersection, determine radiance along
primary ray - Determines pixel color
- Needed
- Local material color and reflection properties
- Object texture
- Local illumination of intersection point
- Can be impossible to determine correctly
4Primary Ray Generation
- Ray from viewpoint through pixel into scene
pinhole camera model - Compute intersection of ray with scene geometry
- Pixel color intersected object point color
shading - Hidden surface detection consider only closest
hit surface
5Recursive Ray Tracing
- Searching recursively for paths to light sources
- Interaction of light material at intersection
points - Recursively trace new rays in reflection,
refraction and light direction
shadow rays
reflected ray
refracted ray
pixel
image plane
primary ray
viewpoint
6Ray Tracing Algorithm
- Trace(ray)
- Search the next intersection point ? (hit,
material) - Return Shade(ray, hit, material)
- Shade(ray, hit, material)
- For each light source
- if ShadowTrace(ray to light source, distance)
- Calculate reflected radiance (i.e. Phong)
- Adding to the reflected radiance
- If mirroring material
- Calculate radiance in reflected direction
Trace(R(ray, hit)) - Adding mirroring part to the reflected radiance
- Same for transmission
- Return reflected radiance
- ShadowTrace(ray, dist)
- Return false, if intersection point with distance
lt dist has been found
7Recursive Ray Tracing
- Pixel color depends on material property at
ray-surface intersection point - Shading
- Needs illumination at intersection point
- of new rays depends on material properties
- Mirror 1 ray
- Semi-transparent 2 rays
- Diffuse ??? Rays
8Shading
- Intersection point determines primary rays
radiancegt determines pixel color - Diffuse object color at intersection point
- No variation with viewing angle diffuse,
Lambertian - Must still be illuminated
- Scales linearly with received radiosity
- No illumination in shadow black
- Non-Lambertian Reflectance
- Surface point appearance depends on illumination
direction and viewing direction - Local Bi-directional Reflectance Distribution
Function (BRDF) - Simple cases
- Mirror, glass secondary rays
- Point light source shadow ray
- Extended light sources, indirect illumination
arbitrarily difficult
9Angle and Solid Angle
- , the angle subtended by a curve in the plane, is
the length of the corresponding arc on the unit
circle. - , the solid angle subtended by an object, is the
surface area of its projection onto the unit
sphere, - Solid angle unit steradians sr
10Solid Angle in Spherical Coordinates
Infinitesimally small solid angle
11Solid Angle for a Small Area
- The solid angle subtended by a small surface
patch S with area ?A is obtained after dividing
the area of its projection - by the square of the distance to the origin
12Radiometry
- Radiometry is the science of measuring radiant
energy transfers. Radiometric quantities have
physical meaning and can be directly measured
using proper equipment such as spectral
photometers. - Radiometric Quantities
- energy watt second n h?
- radiant power (total flux) watt ?
- radiance watt/(m2 sr) L
- irradiance watt/m2 E
- radiosity watt/m2 B
13Radiometric Quantities Radiance
- Radiance is used to describe radiant energy
transfer. - Radiance L is defined as the power (flux)
traveling at some point x in a specified
direction, per unit area perpendicular to the
direction of travel, per unit solid angle. - Thus, the differential power d2F radiated through
the differential solid angle d?, from the
projected differential area dA cos? is
14Spectral Properties
- Since light is composed of electromagnetic waves
of different frequencies and wavelengths, most of
the energy transfer quantities are continuous
functions of wavelength. Thus, total radiance is
expressed as the integral of spectral radiance
over the spectrum
15Radiometric Quantities Irradiance
- Irradiance E is the total power per unit area
(flux density) incident onto a surface with a
fixed orientation. To obtain the total flux
incident to dA, the incoming radiance Li is
integrated over the upper hemisphere O above the
surface
16Radiometric Quantities Radiosity
- Radiosity B is defined as the total power per
unit area (flux density) leaving a surface. To
obtain the total flux radiated from dA, the
outgoing radiance Lo is integrated over the upper
hemisphere O above the surface.
17Photometry
- The human eye is sensitive to a limited range of
radiation wavelengths (from 380nm to 770nm). The
response of our visual system is not the same for
all wavelengths, and can be characterized by the
luminous efficiency function V( ) which
represents the average human spectral response. - A set of photometric quantities can be derived
from radiometric quantities by integrating them
against the luminous efficiency function V( ).
18Radiometry vs. Photometry
Physics-based quantities
Perception-based quantities
Weighted with luminous efficiency function
19Surface Radiance
- Visible surface radiance
- Surface position
- Outgoing direction
- Incoming illumination direction
- Self-emission
- Reflected light
- Incoming radiance from all directions
- Direction-dependent reflectance
20Reflection Equation - Reflectance
- Reflection equation
- Reflectance
- Ratio of reflected to incident power (radiosity /
irradiance) - Directional-hemispherical reflectance fraction
of incident irradiance coming from a given
direction reflected in all possible directions
21Bidirectional Reflectance Distribution Function
- BRDF describes surface reflection for light
incident from direction (??,f?) observed from
direction (?i,fi) - Bidirectional
- depends on two directions (4-D function)
- Distribution function
- Unit 1/sr
22BRDF Properties
- Helmholtz reciprocity principle
- BRDF remains unchanged if incident and reflected
directions are interchanged - Smooth surface isotropic BRDF
- reflectivity independent of rotation around
surface normal - BRDF has only 3 instead of 4 degrees of freedom
23BRDF Properties
- Characteristics
- BRDF units sr--1
- not intuitive
- Range of values
- from 0 (absorption) to
- ? (reflection, d -function)
- Energy conservation law
- No self-emission
- Possible absorption
- Reflection only at the point of entry (xi xo)
- No subsurface scattering
24Reflection Geometry
- Direction vectors (normalize)
- N surface normal
- I vector to the light source
- V viewpoint direction vector
- R(I) reflection vector
- R(I) I - 2(IN)N
- Tangential surface local plane
Top view
R(V)
N
R(I)
N
R(I)
I
I
R(V)
V
V
25Ideal Specular Reflection
- Angle of reflectance equal to angle of incidence
- Reflected vector in a plane with incident ray and
surface normal vector
R(-I) 2 cos? N -2(I N) N R(I) I - 2(I N)
N
26Mirror BRDF
- Dirac function d(x)
- d(x) zero everywhere except at x0
- unit integral
- Specular reflectance ?s
- ratio of reflected radiance in reflection
direction and incoming radiance - dimensionless quantity between 0 and 1
27Law of Refraction
- Snells law
- Faster
- Total internal reflection
- Reflectance/Transmittance
- Incident-angle dependent Fresnel term
N x T ? N x I
n1
T ? I ? N
n2
? -? I N (1- ? 2(1-(I N ) 2 )) 1/2
1- ? 2(1-(I N ) 2 ) lt 0
28Fresnel Equations
- Light-matter interaction at dielectric surfaces
- Reflection/transmission percentage
- Electromagnetic wave theory
- Maxwell equations, boundary conditions
- Polarization-dependent
- Dispersion
- n wavelength-dependent
29Metal Reflection
- Complex index of refraction
- Free electron gas
- Transmission absorption above Langmuir
frequency - Silver (UV)
- Gold (violet)
- Copper (blue)
- Fresnel reflection term
30Wavelength-dependent Reflectance
- Grazing angle
- Total reflection
- Illumination color
- Normal incidence
- Highest absorption
- Typical metal color
- Reconstruct wavelength dependence of n
Copper reflectance
31Diffuse Reflection
- Light equally likely to be reflected in any
output direction (independent of input direction) - Constant BRDF
- kd diffuse coefficient, material property
32Lambertian Diffuse Reflection
- Radiosity
- Diffuse Reflectance
- Lamberts Cosine Law
- For each light source
- Lr,d kd Li cos?i kd Li (IN)
33Lambertian Surfaces
Self-Luminous Lambertian Light Source
Illuminated Lambertian Reflector
34Lambertian Objects
35Lambertian Objects II
- Absorption in photosphere
- Path length through photosphere longer from
the Suns rim
- Surface covered with fine dust
- Dust on TV visible best from slanted viewing
angle
? Neither the Sun nor the Moon are Lambertian
36Diffuse Reflection
- Theoretical explanation
- Multiple scattering
- Experimental realization
- Pressed magnesium oxide powder
- Almost never valid at high angles of incidence
- Paint manufacturers attempt to create ideal
diffuse paints
37Wrap-Up
- Recursive Ray Tracing Algorithm
- Primary, secondary, shadow rays
- Shading
- Physical Quantities in Rendering
- Radiance
- Radiosity
- Irradiance
- Special BRDFs
- Mirror
- Glass
- Diffuse