Lecture 3: Slides

Real-Time Rendering (2nd Edition)

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Pradeep Sen Class 3 – January 24, 2007 ECE 595 / CS 491 / CS 591 Real-Time Rendering & Graphics Hardware Pradeep Sen Advanced Graphics Lab Class 3 January 24, 2007 Pradeep Sen Class 3 – January 24, 2007 Pop Quiz! ± Write the orthographic projection matrix that projects the volume defined by the r , l , t , b , n , f planes to the unit cube (0, 1) ± n , f are defined positive and make sure the resulting projection puts view direction at +z. n f t b l r +x +y -z +x +y +z 0 1 1 1 1 Pradeep Sen Class 3 – January 24, 2007 Last time ± Projection transformations ± Clipping Pradeep Sen Class 3 – January 24, 2007 Today ± Finish the rendering pipeline – Rasterization – Texturing – Framebuffer operations ± Discuss the project Pradeep Sen Class 3 – January 24, 2007 Rasterization ± There are two problems the rasterizer must solve: – Determine which pixels are “touched” by the triangle – Determine the value of interpolants at each of these vertices Pradeep Sen Class 3 – January 24, 2007 Rasterization ± Conversion from floating point screen space coordinates into integer pixel coordinates on the screen Pradeep Sen Class 3 – January 24, 2007 Bounding box algorithm void rasterizeTriangle(void) { for (y = y_min; y < y_max; y++) { for (x = x_min; x < x_max; x++) { if insideTriangle(x,y) { generateFragment(x,y); } } } } box y_min y_max x_min x_max Pradeep Sen Class 3 – January 24, 2007 Inside tests v0 v1 v2 Pradeep Sen Class 3 – January 24, 2007 Inside tests void lineEquation(float *v0, float *v1, float *f){ crossProduct(v1, v0, f); } bool insideTriangle(int x,y) { lineEquation(v0, v1, &f0); lineEquation(v1, v2, &f1); lineEquation(v2, v0, &f2); Pt p(x,y,1); if ((dotProduct(p, f0) > 0) && (dotProduct(p, f2) > 0) { // inside the triangle return true; } return false; }
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Pradeep Sen Class 3 – January 24, 2007 Inside tests void rasterizeTriangle(void) { // compute line equations f0,f1,f2 as before Pt p(x_min, y_min, 1); e0 = dotProduct(p,f0);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Lecture 3: Slides - Pop Quiz ECE 595 CS 491 CS 591 Last...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online