Surface Rendering Methods 6 th Week, 2008 Sun-Jeong Kim Polygon Rendering Methods Polygon Rendering Methods Determining the surface intensity at every Determining the surface intensity at every projected pixel position using an illumination model model Light-material interactions Polygonal shading Fl t h di Flat shading Gouraud shading Phong shading Computer Graphics Applications 2
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.
Determining the surface intensity at everyDetermining the surface intensity at every projected pixel position using an illumination modelmodel
Light-material interactions
Polygonal shadingFl t h diFlat shading
Gouraud shading
Phong shading
Computer Graphics Applications2
Flat Shading (1)Flat Shading (1)
Constant-intensity surface renderingConstant-intensity surface renderingAssigning the same color to all projected surface positionspositions
Determining the intensity (RGB color) at a single surface position (ex. a vertex or the polygon centroid)
Fast and simple method
One rendering calculationOne rendering calculationfor each for each polygonpolygon
One rendering calculationOne rendering calculationfor each for each polygonpolygon
Computer Graphics Applications3
Flat Shading (2)Flat Shading (2)
Assumptions:Assumptions:The polygon is one face of a polyhedron (not a section of curved surface)section of curved surface)
All light sources are sufficiently far from the surfaceN⋅L and attenuation constantN L and attenuation constant
Viewing position is sufficiently far from the polygonV⋅R constant
Computer Graphics Applications4
Flat Shading Smooth Shading
Gouraud Shading (1)Gouraud Shading (1)
Intensity-interpolation surface renderingIntensity-interpolation surface renderingLinearly interpolating vertex intensity values across the polygon facesthe polygon faces
One rendering calculationOne rendering calculationfor eachfor each vertexvertex
One rendering calculationOne rendering calculationfor eachfor each vertexvertex
Vertex normal vectorA i th f l t f ll l
for each for each vertexvertexfor each for each vertexvertex
Averaging the surface normal vectors of all polygons sharing that vertex
∑n
kN
∑∑
=
==n
k k
k kV
1
1
N
NN
Computer Graphics Applications5 4321
4321
NNNN
NNNNN
++++++
=V
Gouraud Shading (2)Gouraud Shading (2)
Procedures:Procedures:Determine the average unit normal vector at each vertex of the polygonvertex of the polygon
Apply an illumination model at each polygon vertex to obtain the light intensityg y
Linearly interpolate the vertex intensity over the projected area of the polygonp j p yg
221
411
21
244 I
yy
yyI
yy
yyI
−−
+−−
=2121 yyyy
54
45 I
xx
xxI
xx
xxI pp
p
−+
−=
Computer Graphics Applications6
4545 xxxx −−
Gouraud Shading (3)Gouraud Shading (3)
Wireframe Flat Shading Gouraud Shading
Computer Graphics Applications7
Phong Shading (1)Phong Shading (1)
Normal-vector interpolation renderingNormal-vector interpolation renderingMore accurate interpolation method more realistic
One rendering calculationOne rendering calculationOne rendering calculationOne rendering calculation
More computation than Gouraud method
One rendering calculationOne rendering calculationfor each for each pixelpixel
One rendering calculationOne rendering calculationfor each for each pixelpixel
More computation than Gouraud method
Procedures:Determine the average unit normal vector at each vertex of the polygon
Li l i t l t th t l thLinearly interpolate the vertex normals over the projected area of the polygon
Apply an illumination model at positions along scan
Computer Graphics Applications8
Apply an illumination model at positions along scan lines to calculate pixel intensities
Phong Shading (2)Phong Shading (2)
Wireframe Flat
Computer Graphics Applications9
Gouraud Phong
Local vs Global RenderingLocal vs. Global Rendering
Local lighting model cannot handle:Local lighting model cannot handle:Blocking some of the light source from reaching the other spheresother spheres
Scattering some light among spheres
Global Lighting Model Local Lighting Model
Computer Graphics Applications10
Global EffectsGlobal Effects
Shadow
Translucent Surface
Multiple Reflection
Translucent Surface
Computer Graphics Applications11
Ray TracingRay Tracing
Continuing to bounce the pixel ray around in theContinuing to bounce the pixel ray around in the scene to collect the various intensity contribution
Generalization of the basic ray casting procedureGeneralization of the basic ray casting procedure
Global refection and transmission effectsHi hl li ti d h t li ti di lHighly realistic and photo-realistic display
Computer Graphics Applications12
Basic Ray Tracing Algorithm (1)Basic Ray Tracing Algorithm (1)
The coordinate system for ray tracingThe coordinate system for ray tracingCollecting the intensity contributions for a particular pixel by tracing a light path backward from the pixelpixel by tracing a light path backward from the pixel position into the scene
Computer Graphics Applications13
Basic Ray Tracing Algorithm (2)Basic Ray Tracing Algorithm (2)
Primary raysPrimary rays – ray castingPrimary raysPrimary rays – ray castingVisible surface detection
Secondary raysSecondary rays reflection and refraction raysSecondary raysSecondary rays – reflection and refraction raysRepeating the ray-processing procedures for the secondary rayssecondary rays
Computer Graphics Applications14
Basic Ray Tracing Algorithm (3)Basic Ray Tracing Algorithm (3)
Ray tracing treeRay tracing treeRay tracing treeRay tracing treeThe list of surfaces intersecting ray for each pixel
Left reflection right refractionLeft – reflection, right – refraction
Maximum depth – a user option
Terminating a path in the binary tree for a pixel if anyTerminating a path in the binary tree for a pixel if any one of the following conditions is satisfied:
The ray intersects no surfacesThe ray intersects no surfaces
The ray intersects a light source
The tree has been generated to its maximum allowable depth
Computer Graphics Applications15
Basic Ray Tracing Algorithm (4)Basic Ray Tracing Algorithm (4)
ReflectionReflection
Refraction (transparency)
( )NNuuR ⋅−= 2
Refraction (transparency)
NuT⎞
⎜⎜⎛
−−= ii
ri θηθη
coscosSnell’s law:
θηθη sinsin⎠
⎜⎝
ir
rr ηη iirr θηθη sinsin =
η ηrη iη
Computer Graphics Applications16
Basic Ray Tracing Algorithm (5)Basic Ray Tracing Algorithm (5)
Computer Graphics Applications17
RadiosityRadiosity
More precisely lighting effectsMore precisely lighting effectsConsidering the physical laws governing the radiant-energy transfersenergy transfers
Accurately describing diffuse reflections from a surfacesurface
RadiosityRadiosityThe quantity of radiant flux per unit area that is leaving a surface
R diR diRadianceRadianceThe radiant flux or the radiosity per unit solid angle ( t di )
Computer Graphics Applications18
(steradian)
Basic Radiosity ModelBasic Radiosity Model
Computing radiant-energy intersections betweenComputing radiant-energy intersections between all surfaces in a scene
OpenGL Surface-Property FunctionOpenGL Surface Property Function
Material – reflectivity properties of a surfaceMaterial – reflectivity properties of a surfaceglMaterial{if}(GLenum face, GLenum name, TYPE value);glMaterial{if}v(GLenum face, GLenum name, TYPE *value);glMaterial{if}(GLenum face, GLenum name, TYPE value);glMaterial{if}v(GLenum face, GLenum name, TYPE *value);
face
GL FRONT GL BACK GL FRONT AND BACK
glMaterial{if}v(GLenum face, GLenum name, TYPE value);glMaterial{if}v(GLenum face, GLenum name, TYPE value);