Author: Romain Vergne (
website)
Please cite my name and add a link to my web page if you use this course
Image synthesis and OpenGL: advanced
lighting
Quick links to:
- Importance of natural
lightings
- Irradiance environment maps
- Radiosity mapping
- Radiosity normal mapping
- Irradiance normal mapping
- Environment
influence on dynamic objects
- Dynamic lights
- Sources
Importance of natural
lightings
Same
material / different lighting conditions
Point light
|
Environment
|
Irradiance environment maps
- sum of all light energies received on a part of a surface
- Hypothesis
- Diffuse surface
- Distant illumination
- No shadows
- No inter-reflections
Radiance env map
|
Irradiance env map
|
- Hemispherical integration on each pixel
- Approximation using frequential analysis
Refinable
Basis functions
|
|
|
|
Original
|
Approx order 0
(1 coefs)
RMS = 25%
|
Approx order 1
(4 coefs)
RMS=8%
|
Approx order 2
(9 coefs)
RMS=1%
|
- Spherical harmonics
- good approximation using only 9 coefficients
- per vertex or per fragment
- But
Radiosity mapping
- Indirect lighting
- secondary light sources
- global lighting
- slow!! not real-time
computation: 3min
|
computation: 7h
|
- Solution:
- precompute solution
- use it in real-time applications
- Only works with view-independent materials
- diffuse surfaces (only depends on surface normal)
- \( \longrightarrow \)radiosity:
model the transfer of energy between surfaces
Direct lighting only
|
Direct lighting + radiosity
|
- Light maps
- efficient / fast
- limited to diffuse materials
- limited to static scenes
- no high frequencies
- Problem: what if we do not know the orientation of the surface in
advance (i.e. normal mapping)?
Radiosity normal mapping
- Combine light maps and normal maps
- light map = global illum effect per vertex (low freq)
- normal maps = geometry details
- Surface normal not known in advance
- compute radiosity for a few space directions
- interpolate in the shader according to the (detailed) normal
Radiosity sampling
Radiosity precomputed
for 3 directions
Rendering
- 3 radiosity values per vertex (1 for each direction)
- project normal in the directional space
- interpolate radiosity value from these 3 directions
- Approximate global lighting
- easy to evaluate
- Not too much memory
- Limitations:
- diffuse surfaces
- static objects
- big approximation
Without
radiosity normal mapping
|
|
|
With
radiosity normal mapping
|
|
|
Irradiance normal mapping
- Identical to Radiosity Normal Mapping execpt that
- hemispherical harmonics are used to store irradiance at each sample
- defined in the tangent plane
- refinable basis functions
Spherical
Harmonics (SH) and HemiSpherical Harmonics (HSH)
- Efficient for indirect lighting
- stored per vertex (about 6 coefs)
- fast to evaluate (polynomial expansion)
- Allows to deal with normal variations
- irradiance defined in the whole hemisphere in the tangent plane
- allows big normal variations
- Limitations
- static objects
- object-dependant (not reusable)
- A
video here
Standard light map
(left), Irrandiance Normal Mapping (middle), INM with albedo (right)
Environment
influence on dynamic objects
Irradiance volume
- Ambient cube
- Irradiance sampled in 6 directions
- Can be precomputed at every point of a scene
- Scene sampling
- coarse grid (only needs a low resolution effect)
- by designer (probes placed at different positions in the scene)
- Object lighting
- from a given object
- get the closest ambient cube
- approx irradiance according to surface normal and cube faces
Without ambient cube
|
With ambient cube
|
Light propagation volumes
- Sample secondary sources
- Group samples in a coarse grid
- Propagate samples in neighbor cells
- Use this radiosity information according to object positions in the
scene
Dynamic lights
How to deal with many lights and many objects, covering many pixels?
Three main solution:
Single pass
- For each object
- render object, apply all lighting in one shader
- Limitations
- hidden surfaces: wasted shading
- hard to manage multi-light situations
- hard to integrate with shadows
Multipass lighting
- For each light
- For each object affected by light
- framebuffer += brdf(object,light)
- Limitations
- hidden surfaces: wasted shading
- high batch count (1/object/light)
- lots of repeated work at each pass (objects may be rendering many
times)
Deferred shading
- For each object
- render lighting properties to G-Buffers (positions/normal/color/...)
- For each light
- framebuffer += brdf(G-Buffers,light)
- Integrated in most rendering engines (ex. CryEngine3)
- integrates well with global illum techniques, shadows, npr effects,
screen space ambient occlusion, etc
- lots of variations
- Limitations
- aliasing (needs special post-process algorithms - screen space
anti-aliasing methods)
- transparency (draw transparent objects in a second step)
Sources