Académique Documents
Professionnel Documents
Culture Documents
Chapter 6: Basic
Rendering
CGVR
Scene Definitions
Camera
View Frustrum
View Plane
Objects/Models
Rendering
CGVR
Basics of Rendering
CGVR
Ray-Tracing
Pipeline Rendering
CGVR
Transform
Illuminate
Transform
Clip
Project
Rasterize
Rendering Pipeline
Framebuffer
Display
Rendering: Transformations
CGVR
Modeling transforms
Viewing transforms
Projection transforms
POLYGON-RENDERING METHODS
Constant-intensity rendering aka flat surface
rendering:
Determine color for center of polygon;
Fill the polygon with a constant color.
Ok if:
Object consists of planar faces, and
Light sources are far away, and
Eye point is far away,
or
Polygons are about a pixel in size.
CGVR
Rendering polygons
Constant-intensity rendering aka flat surface rendering:
Determine color for center of polygon;
Fill the polygon with a constant color.
CGVR
Constant-Intensity Shading
CGVR
Flat Shading
Figure.
N1
N4
N3
Constant-Intensity Shading
CGVR
Example 1)
Image with flat shading
CGVR
N1
N4
NV
n
k 1
n
k 1
Nk
Nk
Gouraud Shading
CGVR
CGVR
Gouraud
Flat
Gouraud Shading
CGVR
Example 2)
Image with Gouraud
shading and specular
highlights.
CGVR
CGVR
CGVR
Phong Shading
CGVR
Example 3)
Image with Phong
shading and specular
highlights.
Comparision
Flat shading
The simplest shading method
Difference of two shading models
Phong shading is more accurate way of shading a polygon
since the illumination model is applied to every point
More computationally intensive than the Gouraud
Illumination model is applied more often
Interpolated normals need to be normalized
CGVR
Flat
Gouraud
Phong
CGVR
Comparision
a) Flat shading
b) Gouraud shading
CGVR
c) Phong shading
CGVR
CGVR
CGVR
CGVR
CGVR
CGVR
CGVR
Reflection ray
Secondary ray
Along specular path
Transparent
CGVR
Ray-Tracing Tree
CGVR
Pixel intensity
If tree is empty
Reducing Object-Intersection
Calculation
CGVR
Space-Subdivision Method
CGVR
Example - b
Example - a
Adaptive sampling
Uses unevenly spaced rays in some reason of the pixel area
Ex. More rays can be used near object edges to obtains a
better estimate of the pixel intensities
CGVR
Affine transformations
CGVR
Affine transformations
CGVR
p x u y v t
Homogeneous Coordinates
CGVR
To represent transformations among affine frames, we can loft
the problem up into 3-space, adding a third component to every
point:
p Mp
a b t x x
c d t y y
0 0 1 1
x
u v t y
1
x u y v 1 t
2D Affine Transformations
x a xx x a xy y bx
y a yx x a yy y by
or
x a xx a xy x bx
y a a y b
yx yy y
CGVR
CGVR
Composition of Affine
Transforms
CGVR
Translation
Scaling
Rotation
Shear
Reflection
CGVR
Object space
Image space
CGVR
Depth-Buffer Method
CGVR
Characteristics
CGVR
Easy to implement
CGVR
CGVR
Depth buffer
Refresh buffer
Algorithm
refresh(x, y) = Ibackgnd
CGVR
Advanced
46
CGVR
y scan line
y - 1 scan line
Depth-Buffer Algorithm
CGVR
1.
Depth-Buffer Algorithm
(cont)
2.
CGVR
Calculating Depth
CGVR
Ax By D
z
C
x positions differ by
1, as do adjacent y positions
A( x 1) By D
z'
C
A
z' z
C
Iterative Calculations
CGVR
1
x' x
m
CGVR
A B
z' z m
C
B
z' z
C
Z Buffer Algorithm
CGVR
Advantages
It is easy to implement.
It reduces the speed problem if implemented in
hardware.
It processes one object at a time.
Disadvantages
It requires large memory.
It is time consuming process.
CGVR
Basic functions
Painting
CGVR
The distant mountains are painted first, followed by the closer meadows; finally, the
trees, are painted.
Overlapping polygons
can cause the algorithm
to fail
Algorithm
CGVR
Process
CGVR
CGVR
CGVR
Depth-sort algorithm
surface 2
surface 1
Depth-sort algorithm
CGVR
Depth-sort algorithm
CGVR
X or Y - extents not
overlap?
z
Depth-sort algorithm
CGVR
S
S
Test is true
x
Depth-sort algorithm
CGVR
Test is true
S
x
Depth-sort algorithm
CGVR
S
zv
xv
Test is true
Depth-sort algorithm
CGVR
Overlapping Tests
CGVR
Difficult
CGVR
S
S
(1)
zv
xv
zv
xv
(4)
xv
S
zv
(2)
S
(3)
xv
zv
Surface Reordering
CGVR
zv
<S S>
xv
zv
xv
<S S, then S S>
Drawback
CGVR
Infinite loop
Flag any surface that has been reordered to a
farther depth
Painters Algorithm
Advantages of Painters Algorithm
Simple
Easy transparency
Disadvantages
Have to sort first
Need to split polygons to solve cyclic and intersecting objects
CGVR