Top Banner
CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan [email protected]
122
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

CST 494/598

Intro to Applied Computer Graphics

Anshuman [email protected]

Page 2: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.
Page 3: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 3

Problem Statement

The physics of how light interacts with the environment is very complicated we need (lots of) simplification

Ingredients:models to describe light sources

models to describe material properties(surface properties)

rendering algorithms

Page 4: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 4

Overview

Important Rendering MethodsHardware-based rendering: based on rasterization

Software-based rasterization

Ray tracing

Radiosity

Path Tracing

Photon Mapping

Boundaries are not clear! - lots of overlap

Page 5: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 5

Overview

Many specific “features”environment mapping

texture mapping

bump mapping

transparency

fog

displacement mapping

shadow mapping

motion blur

How to integrate “features” into different rendering algorithms?

Page 6: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 6

Light Sources

point light sourcedirectional point light sourcedistributed light source (“area light source”)

Page 7: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 7

Surface Lighting Effects

diffuse reflection

specular reflection

reflections fromother surfaces

Page 8: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 8

Basic Illumination Models

empirical modelslighting calculations

surface properties (glossy, matte, opaque,…)

background lighting conditionslight-source specificationreflection, absorption

ambient light (background light) Iaapproximation of global diffuse lighting effects

Page 9: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 9

Ambient Light Reflection

constant over a surfaceindependent of viewing directiondiffuse-reflection coefficient kd (0 kd 1)

adambdiff IkI

Page 10: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 10

Illumination and Shading

shaded surfaces generate a spatial impression

the flatter light falls on a surface,the darker it will appear

therefore:we need the incident light direction

or the position of the (point) light source

Page 11: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 11

..

L

L

I = IL · cos

Lambert's Law

when considering the material:

I = kd Il cos

l

l

l

Page 12: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 12

Lambertian (Diffuse) Reflection

ideal diffuse reflectors (Lambertian reflectors)brightness depends on orientation of surface

Lambert’s cosine law

cos, lddiffl IkI

Page 13: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 13

Diffuse Reflection

angle of incidence [0°,90°] surface illuminated

)(, LNIkI lddiffl

Page 14: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 14

Diffuse Reflection Coefficient

varying kd

result for varying values of kd, Ia = 0

0 0.2 0.4 0.6 0.8 1

Page 15: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 15

Ambient and Diffuse Reflection

total diffuse reflection )( LNIkIkI ldaal,diff

(sometimeska for ambientlight)

Page 16: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 16

Specular Highlights

this area must be lighter than the shading model calculates, because the light source is reflected directly into the viewer's eye

Page 17: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 17

Specular Reflection Model

reflection of incident light around specular-reflection angle

empirical Phong model

snll,spec II cos

Page 18: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 18

cos 8cos 64cos 128cos 256cos

Specular Reflection Coefficient ns

sncos

Page 19: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 19

cos

64cos

256cos

Specular Reflection Coefficient ns

sncos

Page 20: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 20

Specular Reflection Coefficient

empirical Phong modelns large shiny surface

ns small dull surface

snll,spec II cos

Page 21: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 21

Fresnel Specular Refl. Coefficient

Fresnel’s laws of Reflectionspecular reflection coefficient W()

snll,spec IWI cos)(

specular reflection coefficient as a function of angle of incidence for different materials

Page 22: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 22

NLNLR )2(

calculation of R:

Simple Specular Reflection

W() constant for many opaque materials (ks)

snlsl,spec RVIkI )(

LNLNR )2(

Page 23: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 23

Specular Reflection Results

snlsl,spec RVIkI )(

Page 24: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 24

Simplified Specular Reflection

simplified Phong model with halfway vector H

snlsspec RVIkI )( sn

lsspec HNIkI )(

VLVL

H

Page 25: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 25

Diffuse and Specular Reflection

n

l

nlsldlaa

sHNkLNkIIkI1

)()(

ambient

ambient+ diffuse

ambient+ diffuse

+ specular

Page 26: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 26

Other Aspects

intensity attenuation with distance

anisotropic light sources (Warn model)

transparency (Snell’s law)

atmospheric effects

shadows

Page 27: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 27

Polygon-Rendering Methods

application of illumination model to polygon rendering

Flat shading: constant-intensity for polygon

Gouraud Shading: compute light interaction at vertices + interpolate colors

Optimal Solution: compute lighting per pixel

Flat Gouraud

Page 28: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 28

Polygon Shading: Interpolation

the shading of a polygon is not constant, because it normally is only an approximation of the real surface interpolation

Gouraud shading: interpolate intensities

Phong shading: interpolate normal vectors

Page 29: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 29

Gouraud Shading Overview

intensity-interpolationdetermine average unit normal vector at each polygon vertexapply illumination model to each vertexlinearly interpolate vertex intensities

n

kk

n

kk

V

N

N

N

1

1

Page 30: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 30

1. find normal vectors at corners and calculate shading (intensities) there: Ii

Gouraud Shading

I 1

I 2

I 3

Page 31: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 31

1. find normal vectors at corners and calculate shading (intensities) there: Ii

2. interpolate intensities along the edges linearly: I, I’

Gouraud Shading

I 1

I 2

I 3

I= t·I 1+(1-t)·I 2 I'=u·I 2+(1-u)·I 3

Page 32: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 32

1. find normal vectors at corners and calculate shading (intensities) there: Ii

2. interpolate intensities along the edges linearly: I, I’

3. interpolate intensities along scanlines linearly: Ip

Gouraud Shading

I 1

I 2

I 3

I= t·I 1+(1-t)·I 2 I'=u·I 2+(1-u)·I 3

v·I +(1–v)·I '

Page 33: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 33

Gouraud Shading

interpolating intensities

221

411

21

244 I

yyyy

Iyyyy

I

545

44

45

5I

xx

xxI

xx

xxI

ppp

Page 34: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 34

Gouraud Shading

incremental update

221

11

21

2I

yyyy

Iyyyy

I

21

12

yyII

II

Page 35: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 35

Problems of Gouraud Shading

darklight

dark

darkdark

dark

highlights can get lost or growcorners on silhouette remainMachband effect is visible at some edges

Page 36: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 36

Gouraud Shading Results

no intensity discontinuities

Mach bands due to linear intensity interpolation

problems with highlights

flat Gouraud

Page 37: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 37

Phong Shading

instead of intensities the normal vectors are interpolated, and for every point the shading calculation is performed separately

darklight

dark

Page 38: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 38

Phong Shading Principle

normal-vector interpolationdetermine average unit normal vector at each polygon vertex

linearly interpolate vertex normals

apply illumination model along each scan line

Page 39: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 39

Phong Shading Overview

1. normal vectors at corner points2. interpolate normal vectors along the edges3. interpolate normal vectors along scanlines

& calculate shading (intensities) for every pixel

P

Page 40: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 40

Phong Shading Normal Vectors

normal-vector interpolation

221

1Nyy

yy

121

2Nyy

yyN

Page 41: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 41

Phong Shading

incremental normal vector update along and between scan lines

comparison to Gouraud shadingbetter highlights

less Mach banding

more costly

Page 42: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 42

Ray Tracing Concepts

visibility calculation

L1

1

shading

L2 2nd light source

2

light source

Page 43: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 43

Ray Tracing Concepts

L1

L2

shadows

reflection

shading of the reflected object

Page 44: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 44

Ray Tracing Concepts

for whole image:ray through every pixel

shadows

reflection

visibility calculation

shading

for perspectiveprojection: eye point

Page 45: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 45

Ray-Tracing Principle

tracing a ray from the projection reference point through a pixel position with multiple reflections and transmissions

Page 46: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 46

Ray-Tracing Properties

highly realistic imagesvery time consumingglobal reflection, transmissionvisible-surface

detectionshadowstransparencymultiple light

sources

Page 47: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 47

Ray-Tracing

principles of geometric optics

ray-tracing coordinate reference frame

Page 48: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 48

Shading: Diffuse Shading

Id … illumination caused by diffuse shadingxxx … any shading model

(Phong, Blinn, Cook/Torrance,…)

Id = xxx

Page 49: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 49

Ray-Tracing: Shadows

P

L0

a light source influences the result only if there is no intersection with 0 < s < 1

ray = intersection point + s vector to light source

ray = P + s (L0 – P)

P …intersection pointL0…light source position

Page 50: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 50

Ray-Tracing: Shadows and Shading

shadow ray along Lambient light

diffuse reflectionspecular reflection

kaIa

kd(N.L)

ks(H.N)ns

unit vectors at the surface of an object

intersected by an incoming ray along

direction u

Id = kdIa + kd(N.L)

+ ks(H.N)ns

Page 51: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 51

Ray-Tracing: Reflection

Ir = kr · Xr

=

Hr

Ir … illumination caused by reflexionkr … reflection coefficient of the materialXr … shading in the reflected direction

Xr

Page 52: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 52

Ray-Tracing: Transparency

A

B

It = kt · Xt

It … illumination caused by transparencykt … transparency coefficient of the materialXt … shading in the transparency direction

Xt

A

B

sinA::sinB = B:A

Page 53: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 53

Ray-Tr.: Reflection & Transparency

reflection ray

transparency raySnell’s law

ir

ir

sinsin

R = u (2u.N)N

Page 54: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 54

Ray-Tracing: Rays & Ray Tree

primary, secondary rays

corresponding binary ray-tracing tree

reflection and refraction ray paths for one pixel

Page 55: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 55

Ray-Tracing: Complete Shading Method

I = Id + Ir + It

additional requirement: kd + kr + kt 1

Page 56: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 56

4.IF surface of S is transparent THEN trace secondary ray; shading+=influence of transp.

3.IF surface of S is reflective THEN trace secondary ray; shading+=influence of refl.

2.FOR all light sources L DO trace shadow feeler S -> L IF no inters. between S, L THEN shading+=influence of L

1.trace primary ray eye -> p find closest intersection S

FOR all pixels p DO

Ray-Tracing: Basic Algorithm

Page 57: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 57

Ray-Tracing Examples

Page 58: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 58

Ray-Tracing Examples

Page 59: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 59

True Global Illumination Example

Page 60: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 60

„Professional“ Ray tracing

www.oyonale.com

Page 61: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 61

Requirements for Object Data(to use them for ray-tracing)

intersection calculation ray - object possible

surface normal calculation possibleB-Rep: simple

CSG: recursive evaluation

Page 62: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 62

Ray-Surface Intersection

ray equation

for primary rays

for secondaryrays

s.uPP 0

prppix

prppix

PP

PPu

u = R

u = T

describing a ray with an initial-position vector P0 and unit direction vector u

Page 63: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 63

r

P0

Pc

Pu

Ray-Sphere Intersection

parametric ray equation inserted into sphere equation

022 rPP c

022 0 rPsu P c

0 (u² = 1))(2 222 rPsPus

222)( rPPuPus

0PPP c

( )

( )

Page 64: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 64

Ray-Sphere Intersection

discriminant negative no intersections

222)( rPPuPus

“sphereflake”:7381 spheres

3 light sources

22 )( uPuPrPus because u2=1

(to avoid roundoff errors when r2 << |P|2)

Page 65: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 65

Sphereflake

Page 66: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 66

Ray-Polyhedron Intersection

use bounding sphere to eliminate easy caseslocate front facessolving plane equation

uNPND

s 0

u.N < 0

Ax + By + Cz + D = 0

N.(P0 + su) = DP0

N = (A, B, C)N.P = D

P

P

Page 67: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 67

Ray-Polyhedron Intersection

intersection point inside polygon boundaries?

inside-outside test

smallest s to insidepoint is first intersectionpoint of polyhedron

Page 68: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 68

Ray-Surface Intersection

quadric, spline surfaces:parametric ray equation inserted into surface definition

methods like numerical root-finding, incremental calculations

ray-traced scene with global

reflection of texture

Page 69: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 69

Reducing Object-Intersection Calc.

bounding volumesbounding volume hierarchies

Page 70: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 70

Reducing Object-Intersection Calc.

space-subdivision methodsregular grid

octree

Page 71: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 71

Reducing Object-Intersection Calc.

space-subdivision methodsincremental grid traversal

3D Bresenham processing of potential exit faces

ray traversal through a subregion of a cube enclosing a scene

Page 72: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 72

Incremental Grid Traversal

ray direction u / ray entry position Pinpotential exit facesnormal vectors

check signs of components of u

0 kNu

)1,0,0(

)0,1,0(

)0,0,1(

kN

Page 73: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 73

calculation of exit positions, select smallest sk

example:

Incremental Grid Traversal

usPP kinkout

,

DkPN koutk

,

uN

PNDksk

inkk

)0,0,1(kN

x

kk u

xxs 0

Page 74: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 74

Incremental Grid Traversal

variation: trial exit planeperpendicular to largest component of uexit point in 0=> done{1, 2, 3, 4} => side clear{5, 6, 7, 8}=> extra calc.

sectors of the trial exit plane

Page 75: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 75

Ray-Tracing Examples

1298 polygons, 4 spheres, 76 cylinders, 35 quadrics5 light sources

Page 76: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 76

http://www.eleves.ens.fr:8080/home/massimin/ray/povray.html.en

Ray-Tracing Examples

Page 77: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 77

Ray-Tracing Example

Page 78: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 78

1 Billion Raytraced Triangles

www.openrt.de

Page 79: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 79

Radiosity Method

describes the physical process of light distribution in a diffuse reflecting environment

areas that are not illuminated directly are also not completely dark

every object acts as a secondary light source

Page 80: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 80

Radiosity

Radiosity B is the „radiant flux per unit area“ that is leaving a surface

Page 81: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 81

Radiosity Equation

hemi

k. d B

incoming light from the environment

self emission(only for light sources)

reflected lightfrom environment

B = E + k. d B

hemi

radiosityof the point

E

hemi

I(x) dx =

hemi

d B

Page 82: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 82

Radiosity Equation

to calculate the light influence between surfaces

B = E + k. d B

hemi

Radiosity = total light leaving a surface point

B…radiosity hemi…half space over pointE…self emission k…reflection coefficient

Page 83: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 83

Radiosity Properties

diffuse interreflections in a sceneradiant energy transfersconservation of energy, closed environmentssubdivision of sceneinto patches withconstant radiosity Bk

Page 84: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 84

Radiosity: Subdivision into Patches

Bk = Ek + k . Fjk.Bj

j=1

n

the scene is discretized into n "patches"

(plane polygons) Pk, for each of these

patches a constant radiosity Bk is assumed:

k diffuse reflection coefficient of patch k

Fjk “formfactor”: describes how much % of the

influence on patch k comes from patch j; geometric size

B = E + k. d B

hemi

Page 85: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 85

Radiosity Model

Bk radiosity of patch k

Ek self-emission of patch k

BjFjk contribution of other patches

Fjk form factor, contribution of Bj to Bk

k reflectivity factor of patch k

kj

j jkkkk B FEB

Page 86: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 86

Radiosity Equation

solving the radiosity equation

kj

j jkkkk B FEB

kkj

j jkkk EB FB

nn2n1n

2

1

E

EE

B

BB

FF

FFFF

...

...

...

...

2

1

2

1

nn

n2122

n1211

11

......

......

Page 87: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 87

Projection of a Polygon

aA

. .

a·cos

A·cos

a . cos

A . cos

Page 88: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 88

Radiosity: Form Factors

form factor Fjk: contribution of patch j to patch k

2r

Ak

cos kcos j

Ak

Ak'

Pj

.

j k

.

r

FP Aj k

Fjk = 1

,F dAdA kj d

Page 89: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 89

Radiosity: Form Factors

2,

coscos

r

dAF kkj

dAdA kj

form factor Fjk: contribution of patch j to patch k

kA k

kj dAr 2

coscos

,F AdA kj

emitted energyfrom dAj on Ak

j kA A jk

kj

jjk dAdA

rAF 2

coscos1

form factor isaverage overarea Aj

Page 90: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 90

Radiosity: Form Factors

form factor properties

conservation of energy

uniform light reflection

no self-incidence

11

n

kjkF

0jjF

AjFjk AkFkj

Page 91: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 91

Radiosity: Form Factors

form factor calculationmost expensive step in radiosity calculation

numerical integration (Monte Carlo methods)

hemicube approach (hemisphere replaced by hemicube)

Pk

Pj

Page 92: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 92

Radiosity Equation

solving the radiosity equationGaussian elimination

Gauss-Seidel iteration

very time and storage intensive

nn2n1n

2

1

E

EE

B

BB

FF

FFFF

...

...

...

...

2

1

2

1

nn

n2122

n1211

11

......

......

Page 93: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 93

Radiosity Equation

solving the radiosity equationGauss-Seidel iteration

kj

ij jkkk

ik B FEB 1

Pk

Bj

“gathering”

Page 94: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 94

Radiosity Equation

“gathering” vs.“shooting”

kj

ij jkkk

ik B FEB 1

Pk

B j

Pk

B k

x

x

x

x

x

xxxxxxx

x

x

x

x

x

x

x

x

x

x

x

x

x

x

x

x

Page 95: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 95

Progressive Refinement Radiosity (1)

“shooting”select brightest patch k and distribute its radiosity Bk

kj

j jkkkk B FEB j jkkk B FB j B todue

k kjjj B FB k B todue

kk

jjkjj B

AA

FB k B todue jkjkjk FAFA

Page 96: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 96

Progressive Refinement Radiosity (2)[one refinement step]

for selected patch k/* set up hemicube, calculate form factors Fjk */

for each patch j {rad := j*Bk*Fjk*Aj/AkBj := Bj + radBj := Bj + rad}

Bk := 0

Page 97: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 97

Progressive Refinement Radiosity (3)

initially Bk=Bk=Ek,

select patch withhighest BkAk

cathedral rendered with progressive

refinement radiosity

form factors computed with ray-

tracing methods

Page 98: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 98

Radiosity Example Images (1)

image of a constructivist museum rendered with progressive refinement radiosity

Page 99: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 99

Radiosity Example Images (2)

stair tower of a building at Cornell University rendered with progressive refinement radiosity

Page 100: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 100

Radiosity Example Images (3)

2 lighting schemes for an opera production:(left) day view (right) night view

Page 101: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 101

Environment Mapping (1)

reflection mappingdefined over the surface of an enclosing universe (sphere, cube, cylinder)

Page 102: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 102

Blinn, CACM 76

Haeberli/Segal

Environment Mapping (2)

Page 103: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 103

Environment Mapping (3)

information in the environment mapintensity values for light sourcesskybackgroundobjects

pixel areaprojected ontosurfacereflected onto environmentmap

Page 104: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 104

Environment Mapping (4)

Page 105: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 105

Adding Surface Detail (1)

most objects do not have smooth surfacesbrick wallsgravel roadsshag carpets

surface texture required

Page 106: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 106

Adding Surface Detail (2)

modeling surface detail with polygonssmall polygon facets(e.g., checkerboard squares)

facets overlaid on surface polygon (parent)

parent surface used for visibility calculations

facets used for illumination calculations

impractical for intricate surface structure

Page 107: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 107

Texture Mapping (1)

texture patternsmapped ontosurfaces

texture pattern:raster imageor procedure (modifies surface intensities)

Page 108: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 108

Texture Mapping (2)

texture mappingtexture scanning (s,t)(x,y)inverse scanning (x,y)(s,t)

texture-surface transformation

vvv

uuu

ctbsatsvv

ctbsatsuu

),(

),(

Page 109: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 109

Texture Mapping (3)

projecting pixel areas to texture space =

= inverse scanning (x,y)(s,t)

calculation ofanti-aliasing with filter operations

VPM 1-TM 1-

Page 110: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 110

Texture-Map.: Cylindrical Surface

u , with 0 /2

v z with 0 z

x rcos u,y rsin u,z v

MVP

Page 111: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 111

M-1VP

pixel surface point (x,y,z)(x,y,z) (u,v):

Texture-Map.: Cylindrical Surface

M-1T

tvsu ,2/

zvxyu ),/(tan 1

vtus ,/2

MT

Page 112: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 112

Texture Mapping: Anti-aliasing

anti-aliasing with filter operationsproject largerpixel area intotexture space

mip-mapping

summed-areatable method

Page 113: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 113

Procedural Texturing (1)

procedural texture definitiontexture_function (x,y,z) returns intensity

avoid MT

2D (surface texturing) or 3D (solid texturing)

stochastic variations (noise function)

exampleswood grains

marble

leaves

Copyright Alias|Wavefront

Page 114: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 114

Procedural Texturing (2)

a scene with surface characteristics generated using solid-texture methods

Page 115: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 115

Procedural Texturing (3)

gem faces:polygonal facets

rest: quadric & bicubic patches

surface texturing

procedural texturingfor steamy jungle atmosphere

Page 116: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 116

Bump Mapping (1)

bumps are visible because of shading

modeling of bumps is very costly.trick: insert a detail structure T:

T

v

u

+ =

Page 117: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 117

Bump Mapping Examples

Blinn, SIGGRAPH78 Blinn, SIGGRAPH78 Blinn, SIGGRAPH78

Page 118: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 118

Perlin, SIGGRAPH85

Bump Mapping (2)

surface roughness simulatedperturbation function variessurface normal locally

bump map b(u,v)

),( vuP

vu PPN NNn /

surface point

surface normal

nvubvuPvuP ),(),(),( modified surface point

Page 119: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 119

Bump Mapping (3)

nvubvuPvuP ),(),(),(

vu PPN

uuuu bnnbPbnPu

P

)(

, , nbPPnbPP vvvuuu

)()()( nnbbPnbnPbPPN vuvuuvvu

0nn

)()( vuuv PnbnPbNN

Copyright Alias|Wavefront

Page 120: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 120

Bump Mapping (4)

bump map b(u,v) defined as raster imagebu, bv: approximated with finite differences

Copyright Alias|Wavefront

Page 121: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 121

Displacement Mapping

“Correct version of bump mapping”Surface points are moved from their original positionOutline of object changesMuch harder to implement than bump mapping

Rare in practice

Latest hardware partially supports it

Page 122: CST 494/598 Intro to Applied Computer Graphics Anshuman Razdan razdan@asu.edu.

A Razdan 122

Combination of Mapping Methods

armor surface =bump mapping +

environment mapping +

texture mapping