implementation of a renderer consider programs are processd by the system line & polygon,...

12
Implementation of a Render er Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation pro cess, H/W & S/W Extra functions Texture mapping and use of the alpha ch annel

Upload: owen-cooper

Post on 18-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

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

Page 2: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

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

Page 3: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

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

Page 4: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

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.

Page 5: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

Implementation of transformation

Normalization device coordinates x’ = x y’ = y z’ = 0

Window(screen) coordinates

Page 6: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

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

Page 7: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

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

Page 8: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

Cohen-Sutherland line clipping algorithm in 3D

B4 1 if Z > Znear B5 1 if Z < Zfar

Page 9: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

Liang-Barsky Clipping

Parametric Line Clipping Algorithm Two define a line in the plane.

Page 10: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

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’

Page 11: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

Sutherland-Hodgeman Polygon Clipping

Process polygon against each of the 4 boundaries in turn (left, right, bottom, top)

Top Bottom Right Left

Page 12: Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation

Other method for polygon clipping

Bounding Boxes The smallest rectangle, aligned with the

window, that contains the polygon

Clipping in the Frame buffer - scissoring