chap 5, global illumination (cg-u)1cggm lab.,csie dept.,nctu jung hong chuang chap 5 global...

43
Chap 5, Global illumination (CG-U) 1 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel’s book (2nd ed.) on shading Global illumination Ray tracing Radiosity

Upload: tamsin-fay-jackson

Post on 17-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 1 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Chap 5 Global Illumination

Chap 6 of Angel’s book (2nd ed.) on shading

Global illumination Ray tracing Radiosity

Page 2: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 2 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Shading Local lighting

Light-material interactions can be computed, independent of any other surfaces in the scene.

The calculations depend on only the surface material properties, surface’s local geometry, and parameters of the light sources.

Can be added to a fast pipeline graphics architecture.

Global lighting Lighting is a recursive process and amounts to

an integral equation, the rendering equation. Approximations: ray tracing and radiosity.

Page 3: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 3 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light and matter -1

Light and surface We see the color of the light reflected from

the surface toward our eyes. Human’s perception vs. computer image

Page 4: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 4 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light and matter -2

Light–material interaction When light strikes a surface, some of it is

absorbed, some of it is reflected, and some of it is transmitted through the material.

Specular surfaces, diffuse surfaces, translucent surfaces

Page 5: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 5 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light Sources -1

Light source An object that emits light only through

internal sources. Illumination function

Each point (x,y,z) on the surface of the light source can emit light that is characterized by

: the direction of emission : wavelength

),,,,,( zyxI),(

Page 6: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 6 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light Sources -2

On a surface point that is illuminated Total contribution of the source is obtained

by integrating over the surface of the source. The calculation is difficult for a distributed

light source.

Page 7: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 7 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light Sources -3

Four types of light source Ambient lighting

Provides a uniform light level in the scene. Can be characterized by a constant intensity

Ia=[Iar,Iag,Iab] Each surface can reflect this light differently.

Point light sources Spotlights Distant light

Page 8: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 8 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light Sources -4

Point light sources An ideal point source emits light equally in

all directions. A point source at p0 can be characterized by

At a surface point p, the intensity of light received from the point source is

)(

)(

)(

)(

0

0

0

0

pI

pI

pI

pI

b

g

r

)(1

),( 02

0

0 pIpp

ppI

Page 9: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 9 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light Sources -5

Point light sources An ideal point source emits light equally in

all directions. A point source at p0 can be characterized by

At a surface point p, the intensity of light received from the point source is

)(

)(

)(

)(

0

0

0

0

pI

pI

pI

pI

b

g

r

)(1

),( 02

0

0 pIpp

ppI

Page 10: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 10 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light Sources -6

Spotlight A point source with limited angles at which

light can be seen. Represented as a cone Distribution of the light within the cone

Uniform Represented as a function of , such as ecos

Page 11: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 11 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light Sources -7

Distant light sources The light source is far from the surface. The source becomes point sources. Illuminate objects with parallel rays of light. In calculation, the location of the source is

replaced by the direction of the parallel rays.

Page 12: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 12 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Phong reflection model An efficient computation of light-

material interactions. Consists of three terms

Ambient term Diffuse term Specular term

))()([](1

[]2

vrLknILkcdbda

LkI ssddaa

Page 13: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 13 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Computing vectors Normal vectors

Plane Plane equation Three non-coplanar points

Implicit equations F(x, y, z)=0

Parametric surfaces P(u, v)

Angle of reflection

Page 14: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 14 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Polygonal shading Flat shading

Produces Mach bands along the edges. glShadeMode(GL_FLAT)

Gouraud shading glShadeMode(GL_SMOOTH)

Phong shading No hardware support Almost always done off line

Page 15: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 15 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light sources in OpenGL -1

OpenGL supports 4 types of light sources, and allows at most 8 light sources in a program. Each must be individually specified and enabled . glLightfv(source, parameter, pointer_to_array) for vector parameters

Source: source id, parameter: parameter type Position or direction of the light source Amount of diffuse, specular, and ambient light

associated with the light source. glLightf(source, parameter, value) for scalar parameters

Page 16: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 16 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light sources in OpenGL -2

Glfloat light0_pos[]=[1.0, 2.0, 3.0, 1.0]; (point source) or

Glfloat light0_dir[]=[1.0, 2.0, 3.0, 0.0]; (distant light)

Glfloat diffuse0 []=[1.0, 0.0, 0.0, 1.0]; Glfloat specular0 []=[1.0, 1.0, 1.0, 1.0]; Glfloat ambient0 []=[1.0, 0.0, 0.0, 1.0];

glEnable(GL_LIGHTING); glEnable(GL_LIGHT0);

glLightfv(GL_LIGHT0, GL_POSITION, light0_pos); glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffues0); glLightfv(GL_LIGHT0, GL_SPECULAR, specular0);

Page 17: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 17 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light sources in OpenGL -3

For global ambient

Glfloat global-ambient[]=[1.0, 0.1, 0.1, 1.0];

glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient);

For distance term based on

The constant, linear, and quadratic term can be set individually by

glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, a); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, b); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, c);

2

1)(

cdbdadf

Page 18: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 18 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light sources in OpenGL -4

Spotlight Specify spotlight direction, exponent, and the

angle

glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light0_dir); glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, e); glLightf(GL_LIGHT0, GL_SPOT_SUTOFF, a);

OpenGL assumes that the viewer is infinitely far from the scene, so the direction to the viewer is unchanged. The mode can be changed by

glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);

Page 19: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 19 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Light sources in OpenGL -5

Spotlight Specify spotlight direction, exponent, and the

angle

glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light0_dir); glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, e); glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, a);

OpenGL assumes that the viewer is infinitely far from the scene, so the direction to the viewer is unchanged. The mode can be changed by

glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);

Page 20: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 20 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Material specification in OpenGL -1

Match up the supported light sources and with the Phong reflection model.

We can specify different material properties for the front and back faces.

OpenGL functions glMaterialfv(face, type, pointer_to_array); glMaterialf(face, type, value)

One for vector, another for scalar parameters. face: GL_FRONT_AND_BACK, GL_FRONT,

GL_BACK type: GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR,

GL_SHININESS (exponent, use glMaterialf())

Page 21: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 21 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Material specification in OpenGL -2

The material values remain the same until changed, and when changed, affect only surfaces defined after the change.

The emission component of a surface can be defined by

glMaterialfv(face, GL_EMISSION, pointer_to_array);

Useful if we want a light source to appear in the image.

This term is not affected by any of the light sources, and it does not affect any other surfaces.

Page 22: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 22 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Global rendering

Phong illumination model Diffuse and specular term: light

comes directly from the light. Ambient term: A constant estimating

the global illumination from indirectly reflected and refracted light.

Global illumination Effect of indirectly reflected and

refracted lighting.

Page 23: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 23 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Ray tracing -1

HSR ray tracing (one pass) Computes the visible point for each

pixel and then determine the local illumination.

Recursive ray tracing Incorporate the following in a single

framework HSR Global specular interaction by simulating

indirect reflection and refraction of light Hard-shadow calculation

Page 24: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 24 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Ray tracing -2

Ray: formed as a ray from eye to a pixel.

HSR: first hit of the eye ray. Indirect lighting: recursive ray tracing

At each ray-object intersection, a reflected and a refracted ray are fired to trace the light ray propagation.

Page 25: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 25 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Ray tracing – Main program

Select a COP and window on the view planefor each scan line in the window do for each pixel p in the scan line do begin TraceRay(COP, p-COP, 1, pixel_color) end

Page 26: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 26 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Ray tracing – TraceRay()

TraceRay(start, direction, depth, var color: colors)

begin

if depth > max_depth then color:=black

else begin

Intersect ray with all objects and find

intersection point p that is closest to start;

if no intersection then color:=background_color;

else begin

local_color:=….

Compute reflection direction r

TraceRay(p, r, depth+1, reflected_color);

Page 27: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 27 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Ray tracing – TraceRay()

Compute refraction direction t TraceRay(p, t, depth+1,

refracted_color); Combine(color, local_color,

k_local, reflected_color,

k_reflection, refracted_color,

k_refraction); end end end

Page 28: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 28 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Intensity calculation

Pixel RGB is determined by the intensity at the first ray-object intersection, which is determined by

At each ray-object intersection, the RGB at that point is obtained similarly.

refractedtgreflectedrglocal IkIkII

Page 29: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 29 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Shadow using ray tracing Fire a shadow ray at a visible ray-object

intersection. If the shadow ray is interrupted, the point is

under shadow Shadow effect:

Assume the objects are wholly opaque.

Reduce the local term to the ambient value.

Produces sharp shadow boundary.

Page 30: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 30 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Shadow using light buffer -1 Light buffer: A cube of six faces with the

point light source as center, and whose faces are partitioned to cells.

Set-up: All polygons are projected to each face using

the light position as the COP. Each cell contains a list of polygons that can

be seen from the light source through the cell.

The polygon are sorted in ascending order of the depth.

Page 31: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 31 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Shadow using light buffer -2 Shadow testing:

Find the cell that the shadow ray passes. Check to see if there is a polygon on the

cell’s sorted list that is in front the point.

Page 32: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 32 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Speed-Up Methods

Adaptive depth control Bounding volume and BV hierarchy First-hit speed up Spatial coherence

Uniform partition Octree Binary Space Partition

Ray space subdivision Ray Coherence

Page 33: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 33 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Radiosity -1

Ray tracing Deals with scenes of perfect specular and

transmission patches, and approximates diffuse interaction by ambient term.

Scene geometry can be any. Point light source only.

Radiosity Deals with perfect diffuse interior scenes. Scene geometry is polygonal patches. A single patch reflects light received from

every other patches and also emit light if it is a light source.

Page 34: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 34 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Radiosity -2

Radiosity (cont.) The diffuse interaction between patches

depends on their geometry (distance and orientation).

Conservation of light energy leads to an equilibrium in which light intensity is assume to be constant across a patch.

A light source is treated like any other surfaces except it possesses an initial (non-zero) radiosity.

Shadows are dealt with without add-on procedure, intensity within a shadow can be more effectively handled.

Radiosity calculation is view-independent.

Page 35: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 35 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Radiosity -3

Page 36: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 36 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Formulating Radiosity Equations

Radiosity The energy per unit area leaving a surface

patch per unit time and is the sum of emitted and the reflected energy

Fji: the form factor specifying the fraction of energy leaving entire patch j that directly arrives at entire patch i.

i

jji

n

jjiii

jji

n

jjiiiii

A

AFBEB

AFBAEAB

1

1

Page 37: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 37 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Formulating Radiosity Equations

Reciprocity relation For a pair of equally sized emitter and

receiver, the fraction of energy emitted by one and received by the other is identical to the refraction of energy going the other way.

With reciprocity relation

jjiiji AFFA

iij

n

jjiiij

n

jjiii EFBBorFBEB

11

Page 38: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 38 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Formulating Radiosity Equations

Ei: input illumination to the system Fij: form factor, F00=0 for plane patch : reflectivity Ei and are wavelength dependent; e.g., (R,G,B)

Solution: Bi – a single radiosity value for each patch

nnnnnnnnn

n

n

E

E

E

B

B

B

FFF

FFF

FFF

2

1

2

1

21

22222212

11121111

1

1

1

ii

Page 39: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 39 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Vertex Intensity Interior vertex e

averaging the radiosities of patches that share e. Boundary vertex b

Find the nearest interior vertex e Apply “vertex’s average = patch’s average”

beb

e

BBBBB

BBBBB

)(2

1)(

2

1

)(4

1

21

4321

Page 40: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 40 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Rendering Using Radiosity

Page 41: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 41 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Solution – Gauss-Seidel Method

Can be solved by any linear solvers Direct methods: Gaussian Elimination,

Decomposition Indirect Methods: Jocobi methd, Gauss-Seidel

method Large size, better handled by iteration

methods. Gauss-Seidel iterative method

Converges for any strictly diagonally dominant systems from any initial solution.

Iteration, initials, termination conditions.

Page 42: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 42 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Solution – Gauss-Seidel Method

The coefficient matrix is strictly diagonally dominant. The sum of form factors from any patch to

other patches must be 1, and the reflectivity is less than 1.

Sum of the elements other than the diagonal on any row is less than 1 on the diagonal, if Fii=0 for i=1,2,…,n (holds for planar or convex patches).

Gauss-Seidel iteration is a gathering process

Page 43: Chap 5, Global illumination (CG-U)1CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang Chap 5 Global Illumination Chap 6 of Angel ’ s book (2nd ed.) on shading

Chap 5, Global illumination (CG-U) 43 CGGM Lab.,CSIE Dept.,NCTU Jung Hong Chuang

Solution

Cost Form factor

O(n2) x O(form-factor) Linear system

O(n3) Space O(n2)

Accuracy Accuracy of form factor computation

(e.g., Hemicube resolution) Meshing resolution