{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

12-scan

# 12-scan - NOTES Scan Conversion and Shading Lecture 12 CPSC...

This preview shows pages 1–4. Sign up to view the full content.

1 Scan Conversion Scan Conversion and Shading and Shading Lecture 12 CPSC 478/578 Spring 2005 NOTES Assignment # 2 ± due Feb. 28 11:59pm ± TA: Wed 6-8, Fri 2-5 Quiz # 1 Feb. 23, 2005 ± Problems/short answer ± Covers material up to the end of lecture Feb. 14, 2005 Feb. 14, 2005 ± Allowed 8.5x11 page of notes ± Will not ask for OpenGL code ± Study guide NOTES ± Reading for this week: Text – Chapter 6 “Viewing” Text - Chapter 11 “A Full Graphics Pipeline Text – Chapter 7 “Hidden Surface Elimination” Carlbom and Paciorek “Planar Projections and Viewing Transformations” ACM Computing Surveys Dec 1978 (handout and ACM DL) 3D Rendering Pipeline (for direct illumination) 3D Primitives Modeling Transformation Modeling Projection Transformation Projection Transformation Clipping Clipping Lighting Lighting Image Viewport Transformation Viewport Transformation Scan Conversion Scan Conversion 2D Image Coordinates 3D Modeling Coordinates 3D World Coordinates 3D Camera Coordinates 2D Screen Coordinates 2D Screen Coordinates Viewing Transformation Viewing 3D World Coordinates 2D Image Coordinates Scan Conversion & Shading P 1 P 2 P 3 Overview ± Scan conversion Figure out which pixels to fill ± Shading Determine a color for each filled pixel Ray Tracing vs. Rendering Pipeline For each pixel Test each polygon along ray Color pixel by closest polygon; For each polygon Test each pixel covered by polygon Color pixel by closest polygon

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Z-Buffer and Intensity Buffer Save the depth at each pixel, or “z”, of the closest polygon found so far Save the color at each pixel of the closest polygon found so far Z Intensity or Color Scan Conversion ± Render an image of a geometric primitive by setting pixel colors ± Example: Filling the inside of a triangle P 1 P 2 P 3 void SetPixel(int x, int y, Color rgba) Scan Conversion ± Render an image of a geometric primitive by setting pixel colors ± Example: Filling the inside of a triangle P 1 P 2 P 3 void SetPixel(int x, int y, Color rgba) Triangle Scan Conversion ± Properties of a good algorithm Symmetric Straight edges Antialiased edges No cracks between adjacent primitives MUST BE FAST! P 1 P 2 P 3 P 4 Triangle Scan Conversion ± Properties of a good algorithm Symmetric Straight edges Antialiased edges No cracks between adjacent primitives MUST BE FAST! P 1 P 2 P 3 P 4
3 Simple Algorithm P 1 P 2 P 3 void ScanTriangle(Triangle T, Color rgba){ for each pixel P at (x,y){ if (Inside(T, P)) SetPixel(x, y, rgba); } } ± Color all pixels inside triangle Inside Triangle Test ± A point is inside a triangle if it is in the positive halfspace of all three boundary lines Triangle vertices are ordered counter-clockwise Point must be on the left side of every boundary line P L 1 L 2 L 3 Inside Triangle Test Boolean Inside(Triangle T, Point P) { for each boundary line L of T { Scalar d = L.a*P.x + L.b*P.y + L.c; if (d < 0.0) return FALSE; } return TRUE; } L 1 L 2 L 3 Simple Algorithm P 1 P 2 P 3 void ScanTriangle(Triangle T, Color rgba){

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 12

12-scan - NOTES Scan Conversion and Shading Lecture 12 CPSC...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online