36
Computer Graphics In4/MSc Computer Graphics Lecture Notes #15 Illumination III View Independent Rendering

Computer Graphics In4/MSc Computer Graphics Lecture Notes #15 Illumination III View Independent Rendering

Embed Size (px)

Citation preview

Computer Graphics In4/MSc

Computer Graphics

Lecture Notes #15

Illumination III

View Independent Rendering

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 2

We’ll look at two methods

• Bidirectional ray tracing– In addition to backward ray tracing (last lecture) we

perform forward ray tracing, from light sources – often identical code for each direction.

– Problem is to match up rays for full transport of light.

• Radiosity– Models diffuse interactions between surfaces.

– Considers whole scene at once, each polygon a source.

• Both do not require the ambient intensity hack.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 3

1. Bidirectional Ray Tracing

L

A

B

C

E*

*

* - these transports would be missed by conventional RT.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 4

Bidirectional Ray Tracing

Forward ray tracing – source to surfaces, illuminates surfaces.

Backward (conventional) ray tracing – eye to surfaces, sees lit surfaces.

Accumulate photon hits for surface intensity – render from eye pt.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 5

Bidirectional Ray Tracing

• Computationally expensive.

• Much more accurate model though.

• Real problem is number of photons to trace.

• Can use refinement methods:– Trace so many photons, render and check…– and so on until rendering acceptable.

• Area sampling techniques can be used.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 6

Bidirectional exampleSingle Pass (Conventional RT) Two Pass (Bidirectional)

Note : caustic due to red transparent ball

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 7

Bidirectional example

200 rays used in lighting pass 400 rays used in lighting pass

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 8

Bidirectional example

800 rays used in lighting pass.

Note:- improved caustic definition,- lighting effect of mirror, - reflection of caustic,- shadowing due to mirror lighting.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 9

Summary of bidirectional RT

• Trace rays from light source to surfaces.

• Gives secondary lighting and caustics that conventional ray tracing misses.

• Accumulate surface hits – may require large number of hits for adequate intensity.

• Code for both ray trace directions can be identical.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 10

2. Radiosity method.

• Calculates diffuse terms by considering scene as a whole and accounting for inter-object reflections.– View independent method.

• Ray tracing represents light as rays shot from one point to another.

• Radiosity considers how the total light energy in the scene is distributed among the surfaces.

• Light sources are not treated differently in radiosity – every surface is a light source.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 11

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 12

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 13

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 14

Radiosity method.Radiosity = amount of energy leaving a surface per unit area, per unit time ( W / m2 ).

Form factorij = ratio of energy leaving surface j that arrives at surface i.

The Radiosity problem :

- Estimate the form factors

- Solve for the entire scene.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 15

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 16

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 17

Example form factors.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 18

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 19

Estimation of form factor by projection of the object onto a hemicube

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 20

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 21

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 22

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 23

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 24

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 25

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 26

Comparison of Illumination techniques• Using a grammar to define the path of light (due to Heckbert):

– L (source); D (diffuse refl.); S (specular refl.); E (eye/view point).

• Ray tracing handles:

– LE; LS*E; LDS*E

• Radiosity handles:

– LE; LD*E

• Polygon renderers handle:

– LE; LDE

• Bidirectional ray tracing handles:

– LE; LS*E; LDS*E; LD*E; and LS*DS*E

– and, in general, L(S|D)*E, but D* not so interesting.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 27

Summary of Global illumination.

• Simulate interactions between objects.– Shadows.– Reflections.– Refraction.– Diffuse inter-reflections.

• Need good object material information.• Non real-time, non interactive…but, as ever

in computer graphics, we can cheat!

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 28

How to cheat !

• Can use texture mapping to replicate global illumination effects in a scanline renderer.

• Reflections :– Environment maps

• Shadows :– Shadow buffer method.

• Diffuse effects :– Light maps.

• Surface details– Bump maps.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 29

Environment maps.

• Capture, or render an image corresponding to the reflection of the scene in a sphere centered at the object.

• Calculate texture coordinates corresponding to a reflective mapping.

– Image indexed by surface normal.

• Maps entire field of view to circle.– Resolution depends upon orientation.

Escher’s gazing ball

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 30

Environment mapping.

Calculate texture coordinates mapping reflection image to model- Need to re-calculate with viewer motion.- Very much an approximation to reflection

- Object doesn’t reflect itself- No change in reflection with position change.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 31

Cubical environment map.Produce from 6 perspective images.

-Possible to produce using standard renderer, or from photographs.

-More uniform resolution than spherical map.

-Easy texture coordinate calculation.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 32

Illumination maps.• Simulate diffuse radiosity-type effects.

– For a fraction of the cost !– Popular in games.

reflectance illuminance radiosity

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 33

Light maps in Quake.

Can use much lower resolution for light map.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 34

Shadow maps.

• Calculate shadows by rendering scene from the point of view of the light source.

• Test each face with the z-buffer to see if it is the closest object and hence not in shadow.

• If not closest – no light contribution.• Accumulate result into texture map,

multiply by surface colour.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 35

Shadow maps.

Computer Graphics In4/MSc

9/11/2007 Lecture Notes #15 36

Bump maps.

• Instead of rendering small scale surface detail, use a texture map to perturb the surface normal.

+ =