implementation of a renderer consider programs are processd by the system line & polygon,...
TRANSCRIPT
Implementation of a Renderer
Consider Programs are processd by the system
line & polygon, outside the view volume Efficiently
Understanding of the implementation process, H/W & S/W
Extra functions Texture mapping and use of the alpha channel
Implementation tasks
Modeling Representation of geometric object
Geometric processing Transformation & Normalization Clipping Hidden surface removal
Rasterization 2D Image, Frame buffer Anti-aliasing
Display Output Screen, Automatically H/W
Basic implementation strategies
Object-Oriented Loop of Object
For (each object) render (object) large amount of memory object independently reguire other buffers such as depth buffer
Image-Oriented Loop of Pixel
For (each) render (pixel) need only limited display memory disadvantage - all time during the rendering process
Implementation of transformation
Model coordinates World coordinates Camera(eye) coordinates
projection matrix Clip coordinates - fit within the clipping volume
X
Y
Z
X
Y
Z
X
Y
Z
X
Y
Z
ObjectCoords.
EyeCoords.
ClipCoords.
NormalizedDeviceCoords.
ScreenCoords.
Implementation of transformation
Normalization device coordinates x’ = x y’ = y z’ = 0
Window(screen) coordinates
Clipping
Definition The process of determining which primitives,
and part of primitives, fit within the clipping volume define by the application
Term Clipper, Accepted – fit within the specified view
volume Rejected, Culled – primitives that can’t appear
on the display are eliminated
Cohen-Sutherland Clipping
8 Separate clipping region Each region assigned 4-bit binary number Outcode
bit 1 => if point above of window bit 2 => if point below of window bit 3 => if point right of window bit 4 => if point left of window
0 0 11
y ymax
x xmin
y ymin
x xmax
ymin
ymax
xmin xmax
1001 1000 1010
0001
0101 0100 0110
00100000
Cohen-Sutherland line clipping algorithm in 3D
B4 1 if Z > Znear B5 1 if Z < Zfar
Liang-Barsky Clipping
Parametric Line Clipping Algorithm Two define a line in the plane.
Polygon Clipping
Cohen-Sutherland and Liang-Barsky algorithms can be applied to polygons on an edge-by-edge basis.
Sutherland and Hodgeman Concave & Convex
1
2
3
45
1
2
3
4’5’
Sutherland-Hodgeman Polygon Clipping
Process polygon against each of the 4 boundaries in turn (left, right, bottom, top)
Top Bottom Right Left
Other method for polygon clipping
Bounding Boxes The smallest rectangle, aligned with the
window, that contains the polygon
Clipping in the Frame buffer - scissoring