graphics graphics lab @ korea university cgvr.korea.ac.kr 1 surface rendering methods...

50
Graphics cgvr.korea.ac.kr 1 Graphics Lab @ Korea University Graphics Lab @ Korea University Surface Rendering Methods 고고고고고 고고고 고고고고 고고고

Upload: angel-ramsey

Post on 17-Jan-2016

238 views

Category:

Documents


0 download

TRANSCRIPT

Graphics

cgvr.korea.ac.kr 1 Graphics Lab @ Korea University Graphics Lab @ Korea University

Surface Rendering Methods

고려대학교 컴퓨터 그래픽스 연구실

cgvr.korea.ac.kr

CGVR

2 Graphics Lab @ Korea University Graphics Lab @ Korea University

Surface Rendering: Shading

Determine a Color for Each Filled Pixel How to Choose a Color for Each Filled Pixel

Each illumination calculation for a ray from the eyepoint through the view plane provides a radiance sample

cgvr.korea.ac.kr

CGVR

3 Graphics Lab @ Korea University Graphics Lab @ Korea University

Shading Methods

Ray Casting Polygon Shading

Ray Tracing

Radiosity

cgvr.korea.ac.kr

CGVR

4 Graphics Lab @ Korea University Graphics Lab @ Korea University

Ray Casting

Simplest Shading Approach Perform independent lighting calculation for every

pixel

i i

niSiiDALAE IKILNKIKII )RV(

i in

iSiiDALAE IKILNKIKII )RV(

cgvr.korea.ac.kr

CGVR

5 Graphics Lab @ Korea University Graphics Lab @ Korea University

Polygon Shading

Can Take Advantage of Spatial Coherence Illumination calculations for pixels covered by same

primitive are related to each other

i i

niSiiDALAE IKILNKIKII )RV(

i in

iSiiDALAE IKILNKIKII )RV(

cgvr.korea.ac.kr

CGVR

6 Graphics Lab @ Korea University Graphics Lab @ Korea University

Polygon Shading Algorithms

Flat Shading

Gouraud Shading

Phong Shading

cgvr.korea.ac.kr

CGVR

7 Graphics Lab @ Korea University Graphics Lab @ Korea University

Polygon Shading Algorithms

Flat Shading

Gouraud Shading

Phong Shading

cgvr.korea.ac.kr

CGVR

8 Graphics Lab @ Korea University Graphics Lab @ Korea University

Flat Shading

Illuminated only by directional light sources Diffuse or viewed from infinitely far away

i i

niSiiDALAE IKILNKIKII )RV(

i in

iSiiDALAE IKILNKIKII )RV(

cgvr.korea.ac.kr

CGVR

9 Graphics Lab @ Korea University Graphics Lab @ Korea University

Flat Shading

One Illumination Calculation per Polygon Assign all pixels inside each polygon the same color

cgvr.korea.ac.kr

CGVR

10 Graphics Lab @ Korea University Graphics Lab @ Korea University

Flat Shading

Objects Look Like They are Composed of Polygons OK for polyhedral objects Not so good for ones with smooth surfaces

cgvr.korea.ac.kr

CGVR

11 Graphics Lab @ Korea University Graphics Lab @ Korea University

Polygon Shading Algorithms

Flat Shading

Gouraud Shading

Phong Shading

cgvr.korea.ac.kr

CGVR

12 Graphics Lab @ Korea University Graphics Lab @ Korea University

Gouraud Shading

Smooth Surface Represented by polygonal mesh with a normal at

each vertex

i i

niSiiDALAE IKILNKIKII )RV(

i in

iSiiDALAE IKILNKIKII )RV(

cgvr.korea.ac.kr

CGVR

13 Graphics Lab @ Korea University Graphics Lab @ Korea University

Gouraud Shading

One Lighting Calculation per Vertex Assign pixels inside polygon by interpolating colors

computed at vertices

Viewer Light

N1

N3N2

V1 L1

Polygon

cgvr.korea.ac.kr

CGVR

14 Graphics Lab @ Korea University Graphics Lab @ Korea University

Gouraud Shading

Bilinearly Interpolate Colors at Vertices Down and Across Scan Lines

I1

I2I3

21 I1IA 31 I1IB

BA1I BA1I

cgvr.korea.ac.kr

CGVR

15 Graphics Lab @ Korea University Graphics Lab @ Korea University

Gouraud Shading

Smooth Shading over Adjacent Polygons Curved surfaces Illumination highlights Soft shadows

Mesh with shared normals at vertices

cgvr.korea.ac.kr

CGVR

16 Graphics Lab @ Korea University Graphics Lab @ Korea University

Gouraud Shading

Produces Smoothly Shaded Polygonal Mesh Piecewise linear approximation Need fine mesh to capture subtle lighting effects

Flat Shading Gouraud Shading

cgvr.korea.ac.kr

CGVR

17 Graphics Lab @ Korea University Graphics Lab @ Korea University

Polygon Shading Algorithms

Flat Shading

Gouraud Shading

Phong Shading

cgvr.korea.ac.kr

CGVR

18 Graphics Lab @ Korea University Graphics Lab @ Korea University

Phong Shading

What if Polygonal Mesh is too Coarse to Capture Illumination Effects in Polygon Interiors?

Viewer Light

N1

N3N2

V1 L1

Polygon

i i

niSiiDALAE IKILNKIKII )RV(

i in

iSiiDALAE IKILNKIKII )RV(

cgvr.korea.ac.kr

CGVR

19 Graphics Lab @ Korea University Graphics Lab @ Korea University

Phong Shading

One Lighting Calculation per Pixel Approximate surface normals for points inside

polygons by bilinear interpolation of normals from vertices

Viewer Light

N1

N3N2

V L

Polygon

N

cgvr.korea.ac.kr

CGVR

20 Graphics Lab @ Korea University Graphics Lab @ Korea University

Phong Shading

Bilinearly Interpolate Normals at Vertices Down and Across Scan Lines

α β

21 N1NA 31 N1NB

γ

BA1N BA1N

N1

N2 N3

cgvr.korea.ac.kr

CGVR

21 Graphics Lab @ Korea University Graphics Lab @ Korea University

Phong Shading

Gouraud

Wireframe

Phong

Flat

cgvr.korea.ac.kr

CGVR

22 Graphics Lab @ Korea University Graphics Lab @ Korea University

Shading & Subdivision

Gouraud PhongFlat

Loop SubdivisionLevel 1

Level 2

Control Mesh

cgvr.korea.ac.kr

CGVR

23 Graphics Lab @ Korea University Graphics Lab @ Korea University

Shading Methods

Ray Casting Polygon Shading

Ray Tracing

Radiosity

cgvr.korea.ac.kr

CGVR

24 Graphics Lab @ Korea University Graphics Lab @ Korea University

Ray Tracing

Extension of Ray Casting Look for the visible surface for each pixel Continue to bounce the ray around the scene

TTRSL LLn

SDAAE IKIKISKLNKIKII )RV( TTRSL LLn

SDAAE IKIKISKLNKIKII )RV(

cgvr.korea.ac.kr

CGVR

25 Graphics Lab @ Korea University Graphics Lab @ Korea University

Ray Tracing

Global Illumination Shadows Refractions Inter-object reflections

Highly Realistic vs. Computation Time

TTRSL LLn

SDAAE IKIKISKLNKIKII )RV( TTRSL LLn

SDAAE IKIKISKLNKIKII )RV(

Transparenc

y

Reflectanc

e

Shadow

cgvr.korea.ac.kr

CGVR

26 Graphics Lab @ Korea University Graphics Lab @ Korea University

Basic Ray Tracing Algorithm

For Each Pixel Ray Primary ray

Test each surface if it is intersected

Intersected: Secondary ray Reflection ray Transparent – Refraction ray

cgvr.korea.ac.kr

CGVR

27 Graphics Lab @ Korea University Graphics Lab @ Korea University

Basic Ray Tracing Algorithm

For Each Pixel Ray Primary ray

Test each surface if it is intersected

Intersected: Secondary ray Reflection ray Transparent – Refraction ray

cgvr.korea.ac.kr

CGVR

28 Graphics Lab @ Korea University Graphics Lab @ Korea University

Ray Tracing Tree

Ray tree represents illumination computation One branch reflection The other branch transmission Terminated reach the preset maximum or strike a light

sourceScene Ray Tree

cgvr.korea.ac.kr

CGVR

29 Graphics Lab @ Korea University Graphics Lab @ Korea University

Ray Tracing Tree

Pixel intensity Sum of intensities at root node Start at terminal node If no surfaces are intersected, the intensity of background

Scene Ray Tree

Iback

Iback Iback

Ipixel

cgvr.korea.ac.kr

CGVR

30 Graphics Lab @ Korea University Graphics Lab @ Korea University

Shading Methods

Ray Casting Polygon Shading

Ray Tracing

Radiosity

cgvr.korea.ac.kr

CGVR

31 Graphics Lab @ Korea University Graphics Lab @ Korea University

Radiosity

Goal Simulate diffuse inter-object reflections and shadows

cgvr.korea.ac.kr

CGVR

32 Graphics Lab @ Korea University Graphics Lab @ Korea University

Radiosity

Basic Idea Treat every polygon as light source

cgvr.korea.ac.kr

CGVR

33 Graphics Lab @ Korea University Graphics Lab @ Korea University

Radiosity

Advantages Physically models shadows and indirect diffuse

illumination Independent of any viewpoint

Equation

ijjiii FBρEB ijjiii FBρEB

Bi = Radiosity of patch iEi = Emission of patch iρi = Reflectivity of patch iFi = Form-factor between patches i and j

cgvr.korea.ac.kr

CGVR

34 Graphics Lab @ Korea University Graphics Lab @ Korea University

Form Factors

Definition Fraction of energy leaving patch j

that arrives at patch i

Computation Project onto unit hemisphere Project onto unit circle base Divide by area of circle Project scene onto hemi-cube

Project ontounit hemisphere

Project ontoHemi-cube

cgvr.korea.ac.kr

CGVR

35 Graphics Lab @ Korea University Graphics Lab @ Korea University

Matrix Solution Methods

Matrix Formulation

Progressive Refinement Iterate shoot radiosity from patches O(n2) computation, but get pretty good solutions

more quickly

nnnnnnnnn

n

n

n

E

E

E

E

B

B

B

B

Fρ1FρFρ

FρFρFρ

FρFρ1Fρ

FρFρFρ1

3

2

1

3

2

1

21

33323313

22222212

11121111

nnnnnnnnn

n

n

n

E

E

E

E

B

B

B

B

Fρ1FρFρ

FρFρFρ

FρFρ1Fρ

FρFρFρ1

3

2

1

3

2

1

21

33323313

22222212

11121111

cgvr.korea.ac.kr

CGVR

36 Graphics Lab @ Korea University Graphics Lab @ Korea University

Matrix Solution Methods

24 iterations

1 iteration

100 iterations

2 iterations

cgvr.korea.ac.kr

CGVR

37 Graphics Lab @ Korea University Graphics Lab @ Korea University

Hierarchical Radiosity

Multiresolution Computation Substructure patches into quad-tree Transfer energy using lower resolution mesh

elements if can do so within error tolerance O(n) computation

cgvr.korea.ac.kr

CGVR

38 Graphics Lab @ Korea University Graphics Lab @ Korea University

Ray Tracing & Radiosity

Dilemma: Radiosity is good at diffuse inter-object reflection Ray tracing is good at specular inter-object reflection

Combine them Example: compute diffuse inter-object reflections in a

ray tracer Monte Carlo methods

cgvr.korea.ac.kr

CGVR

39 Graphics Lab @ Korea University Graphics Lab @ Korea University

Summary

Ray Casting Flat Gouraud Phong

Ray Tracing

Radiosity

Less Expensive

More Accurate

cgvr.korea.ac.kr

CGVR

40 Graphics Lab @ Korea University Graphics Lab @ Korea University

Visible-Line Determination

cgvr.korea.ac.kr

CGVR

41 Graphics Lab @ Korea University Graphics Lab @ Korea University

Visible-Surface Determination with Ambient Illumination only

cgvr.korea.ac.kr

CGVR

42 Graphics Lab @ Korea University Graphics Lab @ Korea University

Individually Shaded Polygons with Diffuse Reflection

cgvr.korea.ac.kr

CGVR

43 Graphics Lab @ Korea University Graphics Lab @ Korea University

Gouraud Shaded Polygons with Diffuse Reflection

cgvr.korea.ac.kr

CGVR

44 Graphics Lab @ Korea University Graphics Lab @ Korea University

Gouraud Shaded Polygons with Specular Reflection

cgvr.korea.ac.kr

CGVR

45 Graphics Lab @ Korea University Graphics Lab @ Korea University

Phong Shaded Polygons with Specular Reflection

cgvr.korea.ac.kr

CGVR

46 Graphics Lab @ Korea University Graphics Lab @ Korea University

Curved Surfaces with Specular Reflection

cgvr.korea.ac.kr

CGVR

47 Graphics Lab @ Korea University Graphics Lab @ Korea University

Improved Illumination Model and Multiple Lights

cgvr.korea.ac.kr

CGVR

48 Graphics Lab @ Korea University Graphics Lab @ Korea University

Texture Mapping

cgvr.korea.ac.kr

CGVR

49 Graphics Lab @ Korea University Graphics Lab @ Korea University

Displacement Mapping

cgvr.korea.ac.kr

CGVR

50 Graphics Lab @ Korea University Graphics Lab @ Korea University

Reflection Mapping