11rendering

Page 1

Graphics

Surface Rendering Methods ????? ??? ???? ???

cgvr.korea.ac.kr

1

Graphics Lab @ Korea University


Surface Rendering: Shading  

CGVR

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

Graphics Lab @ Korea University


Shading Methods 

CGVR

Ray Casting 

Polygon Shading

Ray Tracing

Radiosity

Graphics Lab @ Korea University


Ray Casting 

CGVR

Simplest Shading Approach 

Perform independent lighting calculation for every pixel

I = I E + K A I AL + ∑i ( K D ( N ⋅ Li ) I i + K S ( V ⋅ R i ) I i ) n

Graphics Lab @ Korea University


Polygon Shading 

CGVR

Can Take Advantage of Spatial Coherence 

Illumination calculations for pixels covered by same primitive are related to each other

I = I E + K A I AL + ∑i ( K D ( N ⋅ Li ) I i + K S ( V ⋅ R i ) I i ) n

Graphics Lab @ Korea University


Polygon Shading Algorithms 

Flat Shading

Gouraud Shading

Phong Shading

CGVR

Graphics Lab @ Korea University


Polygon Shading Algorithms 

Flat Shading

Gouraud Shading

Phong Shading

CGVR

Graphics Lab @ Korea University


Flat Shading 

CGVR

Illuminated only by directional light sources 

Diffuse or viewed from infinitely far away

I = I E + K A I AL + ∑i ( K D ( N ⋅ Li ) I i + K S ( V ⋅ R i ) I i ) n

Graphics Lab @ Korea University


Flat Shading ď Ž

CGVR

One Illumination Calculation per Polygon ď Ž

Assign all pixels inside each polygon the same color

Graphics Lab @ Korea University


Flat Shading 

CGVR

Objects Look Like They are Composed of Polygons  

OK for polyhedral objects Not so good for ones with smooth surfaces

Graphics Lab @ Korea University


Polygon Shading Algorithms 

Flat Shading

Gouraud Shading

Phong Shading

CGVR

Graphics Lab @ Korea University


Gouraud Shading 

CGVR

Smooth Surface 

Represented by polygonal mesh with a normal at each vertex

I = I E + K A I AL + ∑i ( K D ( N ⋅ Li ) I i + K S ( V ⋅ R i ) I i ) n

Graphics Lab @ Korea University


Gouraud Shading ď Ž

CGVR

One Lighting Calculation per Vertex ď Ž

Assign pixels inside polygon by interpolating colors computed at vertices N1

Viewer

L1

V1 N2

Light

N3

Polygon Graphics Lab @ Korea University


Gouraud Shading 

CGVR

Bilinearly Interpolate Colors at Vertices Down and Across Scan Lines A = αI1 +(1 − α ) I 2

B = βI1 +(1 − β ) I3 I1

I2

I = (1 − γ ) A + γB I3 Graphics Lab @ Korea University


Gouraud Shading 

CGVR

Smooth Shading over Adjacent Polygons   

Curved surfaces Illumination highlights Soft shadows

Mesh with shared normals at vertices Graphics Lab @ Korea University


Gouraud Shading 

CGVR

Produces Smoothly Shaded Polygonal Mesh  

Piecewise linear approximation Need fine mesh to capture subtle lighting effects

Flat Shading

Gouraud Shading Graphics Lab @ Korea University


Polygon Shading Algorithms 

Flat Shading

Gouraud Shading

Phong Shading

CGVR

Graphics Lab @ Korea University


Phong Shading 

CGVR

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

Light

L1

V1 N3 Polygon

I = I E + K A I AL + ∑i ( K D ( N ⋅ Li ) I i + K S ( V ⋅ R i ) I i ) n

Graphics Lab @ Korea University


Phong Shading ď Ž

CGVR

One Lighting Calculation per Pixel ď Ž

Approximate surface normals for points inside polygons by bilinear interpolation of normals from N1 vertices

Viewer

Light

N V N2

L N3

Polygon Graphics Lab @ Korea University


Phong Shading 

CGVR

Bilinearly Interpolate Normals at Vertices Down and Across Scan Lines A = αN1 +(1 − α ) N 2

N1 α

N2

γ

B = βN1 +(1 − β ) N 3

β N3

N = (1 − γ ) A + γB Graphics Lab @ Korea University


Phong Shading

CGVR

Wireframe

Flat

Gouraud

Phong Graphics Lab @ Korea University


Shading & Subdivision

CGVR

Control Mesh

Loop Subdivision Level 1

Level 2 Flat

Gouraud

Phong Graphics Lab @ Korea University


Shading Methods 

CGVR

Ray Casting 

Polygon Shading

Ray Tracing

Radiosity

Graphics Lab @ Korea University


Ray Tracing 

CGVR

Extension of Ray Casting  

Look for the visible surface for each pixel Continue to bounce the ray around the scene

I = I E + K A I A + ∑L ( K D ( N ⋅ L ) + K S ( V ⋅ R ) ) S L I L + K S I R + KT IT n

Graphics Lab @ Korea University


Ray Tracing 

Global Illumination   

CGVR

Shadows Refractions Inter-object reflections Reflectance

Shadow

Transparency

Highly Realistic vs. Computation Time

I = I E + K A I A + ∑L ( K D ( N ⋅ L ) + K S ( V ⋅ R ) ) S L I L + K S I R + KT IT n

Graphics Lab @ Korea University


Basic Ray Tracing Algorithm 

CGVR

For Each Pixel Ray 

Primary ray 

Test each surface if it is intersected

Intersected: Secondary ray  

Reflection ray Transparent – Refraction ray

Graphics Lab @ Korea University


Basic Ray Tracing Algorithm 

CGVR

For Each Pixel Ray 

Primary ray 

Test each surface if it is intersected

Intersected: Secondary ray  

Reflection ray Transparent – Refraction ray

Graphics Lab @ Korea University


Ray Tracing Tree 

CGVR

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

Graphics Lab @ Korea University


Ray Tracing Tree 

CGVR

Pixel intensity   

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

Scene

Ray Tree

Ipixel

Iback

Iback

Iback Graphics Lab @ Korea University


Shading Methods 

CGVR

Ray Casting 

Polygon Shading

Ray Tracing

Radiosity

Graphics Lab @ Korea University


Radiosity 

CGVR

Goal 

Simulate diffuse inter-object reflections and shadows

Graphics Lab @ Korea University


Radiosity 

CGVR

Basic Idea 

Treat every polygon as light source

Graphics Lab @ Korea University


Radiosity 

Advantages  

CGVR

Physically models shadows and indirect diffuse illumination Independent of any viewpoint

Equation

Bi = E i + ρ i ∑ B j Fij Bi = Radiosity of patch i Ei = Emission of patch i ρi = Reflectivity of patch i Fi = Form-factor between patches i and j Graphics Lab @ Korea University


Form Factors 

Definition 

CGVR

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 onto unit hemisphere

Project onto Hemi­cube Graphics Lab @ Korea University


Matrix Solution Methods 

Matrix Formulation 1 − ρ1F11 − ρ1F12 −ρ F  2 21 1 − ρ 2 F22  − ρ 3 F31 − ρ 3 F32  ⋅  ⋅  − ρ n Fn1 − ρ n Fn 2

CGVR

⋅ ⋅ ⋅ ⋅ ⋅

− ρ1F1n   B1   E1  − ρ 2 F2 n  B 2  E 2  − ρ 3 F3n   B3  =  E 3      ⋅  ⋅   ⋅  1 − ρ n Fnn  B n  E n 

Progressive Refinement  

Iterate shoot radiosity from patches O(n2) computation, but get pretty good solutions more quickly Graphics Lab @ Korea University


Matrix Solution Methods

CGVR

1 iteration 2 iterations 24 iterations

100 iterations Graphics Lab @ Korea University


Hierarchical Radiosity 

CGVR

Multiresolution Computation   

Substructure patches into quad-tree Transfer energy using lower resolution mesh elements if can do so within error tolerance O(n) computation

Graphics Lab @ Korea University


Ray Tracing & Radiosity 

Dilemma:  

CGVR

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

Graphics Lab @ Korea University


Summary 

Ray Casting   

Flat Gouraud Phong

CGVR

Less Expensive

Ray Tracing

More Accurate 

Radiosity Graphics Lab @ Korea University


Visible-Line Determination

CGVR

Graphics Lab @ Korea University


Visible-Surface Determination with Ambient Illumination only

CGVR

Graphics Lab @ Korea University


Individually Shaded Polygons with Diffuse Reflection

CGVR

Graphics Lab @ Korea University


Gouraud Shaded Polygons with Diffuse Reflection

CGVR

Graphics Lab @ Korea University


Gouraud Shaded Polygons with Specular Reflection

CGVR

Graphics Lab @ Korea University


Phong Shaded Polygons with Specular Reflection

CGVR

Graphics Lab @ Korea University


Curved Surfaces with Specular Reflection

CGVR

Graphics Lab @ Korea University


Improved Illumination Model and Multiple Lights

CGVR

Graphics Lab @ Korea University


Texture Mapping

CGVR

Graphics Lab @ Korea University


Displacement Mapping

CGVR

Graphics Lab @ Korea University


Reflection Mapping

CGVR

Graphics Lab @ Korea University


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.