Status – Week 227 Victor Moya. Summary How to lose a week. How to lose a week. Rasterization. Rasterization.

Slides:



Advertisements
Similar presentations
Rezanje črt in poligonov. World window & viewport window viewport screen window world window.
Advertisements

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam September 30, D Clipping 1/14 Clipping (pages , )
Objectives Define Clipping Various clipping methods. Line clipping methods.
Lecture Notes #11 Curves and Surfaces II
Computer Graphics Lecture 8 Arbitrary Viewing II: More Projection, Clipping and Mathematics of 3D Viewing.
10/10/02 (c) 2002 University of Wisconsin, CS 559 Last Time Finished viewing: Now you know how to: –Define a region of space that you wish to view – the.
Course Website: Computer Graphics 4: Viewing In 2D.
1 Clipping. 2 Transformation Sequence X Y Z X Y Z X Y Z X Y Z Object Coords. Eye Coords. Clip Coords. Normalized Device Coords. Screen Coords. Implementation:
Computer Graphics Viewing.
Viewing & Clipping In 2D. 2 of 44 Contents Windowing Concepts Clipping –Introduction –Brute Force –Cohen-Sutherland Clipping Algorithm Area Clipping –Sutherland-Hodgman.
CMPE 466 COMPUTER GRAPHICS Chapter 8 2D Viewing Instructor: D. Arifler Material based on - Computer Graphics with OpenGL ®, Fourth Edition by Donald Hearn,
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 2 1.
Status – Week 228 Victor Moya. Summary Hierarchical Z-Buffer. Hierarchical Z-Buffer.
Classes of Polygons Planar polygons Non-planar polygons Simple
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Clipping II, Hidden Surfaces.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Status – Week 243 Victor Moya. Summary Current status. Current status. Tests. Tests. XBox documentation. XBox documentation. Post Vertex Shader geometry.
Status – Week 231 Victor Moya. Summary Primitive Assembly Primitive Assembly Clipping triangle rejection. Clipping triangle rejection. Rasterization.
Status – Week 226 Victor Moya. Summary Recursive descent. Recursive descent. Hierarchical Z Buffer. Hierarchical Z Buffer.
Status – Week 279 Victor Moya. Rasterization Setup triangles (calculate slope values). Setup triangles (calculate slope values). Fill triangle: Interpolate.
Status – Week 240 Victor Moya. Summary Post Geometry Pipeline. Post Geometry Pipeline. Rasterization. Rasterization. Triangle Setup. Triangle Setup. Triangle.
Status – Week 239 Victor Moya. Summary Primitive Assembly Primitive Assembly Clipping triangle rejection. Clipping triangle rejection. Rasterization.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Clipping.
Status – Week 207 Victor Moya. Summary Z Test box. Z Test box. Z Compression. Z Compression. Z Cache. Z Cache. Stencil. Stencil. HZ Box. HZ Box. HZ Test.
Status – Week 260 Victor Moya. Summary shSim. shSim. GPU design. GPU design. Future Work. Future Work. Rumors and News. Rumors and News. Imagine. Imagine.
Status – Week 280 Victor Moya. Rasterization Setup triangles. Setup triangles. Fill triangle: Interpolate parameters. Fill triangle: Interpolate parameters.
Now Playing: California Stars Billy Bragg & Wilco from Mermaid Avenue
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Graphics Pipeline Clipping CMSC 435/634. Graphics Pipeline Object-order approach to rendering Sequence of operations – Vertex processing – Transforms.
Hidden Surface Removal
Clipping Apart from clipping to the view volume, clipping is a basic operation in many other algorithms –Breaking space up into chunks –2D drawing and.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
CSE Real Time Rendering Week 9. Post Geometry Shaders Courtesy: E. Angel and D. Shreiner – Interactive Computer Graphics 6E © Addison-Wesley 2012.
CAP4730: Computational Structures in Computer Graphics
Games Development 1 Camera Projection / Picking CO3301 Week 8.
Windows, Viewports, and Clipping
Computer Graphics Basic 3D Geometry CO2409 Computer Graphics Week 5-1.
CS418 Computer Graphics John C. Hart
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
Computer Graphics Rendering 2D Geometry CO2409 Computer Graphics Week 2.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Computer Graphics Camera Projection / Picking CO2409 Week 8 - Optional Advanced Material Not on Exam.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Virtual Light Field Group University College London Ray Tracing with the VLF (VLF-RT) Jesper Mortensen
Graphics Graphics & Graphical Programming Lecture 23 - Viewing & Clipping.
A.Aruna/Assistant Professor/SNSCE
2 3D Viewing Process  3D viewing process MC Model Space Model Transformation Model Transformation WC World Space Viewing Transformation Viewing Transformation.
Computer Graphics Viewing. 2 of 30 Viewing in 2D Window in world coordinates. 45  250  Viewport in Device coords 250 x 250 Pixels.
CS552: Computer Graphics Lecture 12: 3D Clipping.
Computer Graphics Clipping.
Advanced D3D Programming Sim Dietrich
Concepts, algorithms for clipping
Graphics Pipeline Clipping
WINDOWING AND CLIPPING
OpenGL 2D Viewing Pipeline
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
WINDOWING AND CLIPPING
Lecture 13 Clipping & Scan Conversion
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
Joshua Barczak CMSC 435 UMBC
Clipping Clipping Sutherland-Hodgman Clipping
Computer Graphics Viewing. 2 of 30 Viewing in 2D Window in world coordinates. 45  250  Viewport in Device coords 250 x 250 Pixels.
Clipping University of British Columbia CPSC 314 Computer Graphics
COMPUTER GRAPHICS Clipping
Presentation transcript:

Status – Week 227 Victor Moya

Summary How to lose a week. How to lose a week. Rasterization. Rasterization.

Rasterization What is the problem with w? What is the problem with w? If w is 0 (vertex in the near plane) then x/w and y/w are infinite! If w is 0 (vertex in the near plane) then x/w and y/w are infinite! You can not draw something in the infinite... You can not draw something in the infinite... If w is < 0 then weird things happen. Wrapping around the infinite. If w is < 0 then weird things happen. Wrapping around the infinite.

Rasterization

Rasterization A vertex with w = 0 and no clipping

Rasterization A vertex with w = 0 and clipping

Rasterization

Rasterization A vertex with w < 0 and no clipping

Rasterization Vertex with w < 0 and clipping

Rasterization That is why clipping should be mandatory... That is why clipping should be mandatory... However using 2DH rasterization (Olano & Greer, McCool) However using 2DH rasterization (Olano & Greer, McCool) We don’t need to divide by w the vertices. We don’t need to divide by w the vertices. The triangle three edge equations can be derived without calculating x/w and y/w for the vertex. The triangle three edge equations can be derived without calculating x/w and y/w for the vertex.

Rasterization That’s fine. That’s fine. But we still have a problem... But we still have a problem...

Rasterization Where do we start drawing? Where do we start drawing? Test all pixels => Pixel Planes Test all pixels => Pixel Planes Evaluate edge equations at all pixels in parallel (usually using tiles). Evaluate edge equations at all pixels in parallel (usually using tiles). Search a region or pixel inside the triangle. Search a region or pixel inside the triangle. Recursive approach. Recursive approach. McCool paper: hierarchical rasterization with Hilber curves. McCool paper: hierarchical rasterization with Hilber curves. Calculate a start point. Calculate a start point. But we can’t use x/w and y/w without clipping!!! But we can’t use x/w and y/w without clipping!!!

Rasterization Test all pixels: Test all pixels: Tiled architecture with evaluators at all pixels. Tiled architecture with evaluators at all pixels. Only uses by Pixel Planes. Only uses by Pixel Planes. Are we not going to use this approach? Are we not going to use this approach? It seems too much hardware... It seems too much hardware... Is applicable to current GPUs? Is applicable to current GPUs?

Rasterization Recursive search: Recursive search: We could try to implement McCool algorithm or another similar. We could try to implement McCool algorithm or another similar. But it takes log(N, M) cycles to generate the first fragment. But it takes log(N, M) cycles to generate the first fragment. And requires to a stack of saved states (McCool actually walks back, expending cycles in the process). And requires to a stack of saved states (McCool actually walks back, expending cycles in the process).

Rasterization But performs trivial clip reject at first level evaluation. But performs trivial clip reject at first level evaluation. Admits early HZ rejection of large triangle regions. Admits early HZ rejection of large triangle regions. Requires multiple HZ levels. Requires multiple HZ levels. And you could reuse the multiple evaluators of stamp based rasterizer for a faster search. And you could reuse the multiple evaluators of stamp based rasterizer for a faster search. Study the cost in hardware and time. Study the cost in hardware and time. To be done? To be done?

Rasterizar

Rasterization

Rasterization

Rasterization

Rasterization

Rasterization

Rasterization

Rasterization

Rasterization Calculate a start point: Calculate a start point: You can actually calculate x/w and y/w and pick a vertex as start point. You can actually calculate x/w and y/w and pick a vertex as start point. But only if w > 0. But only if w > 0. What happens with if w <= 0? What happens with if w <= 0? It seems there is always either It seems there is always either at least one of the three vertices inside the viewport (w > 0) or at least one of the three vertices inside the viewport (w > 0) or at least one viewport corner inside the projected triangle. at least one viewport corner inside the projected triangle. Because the projected triangle should still be a convex polygon (or so I hope). Because the projected triangle should still be a convex polygon (or so I hope).

Rasterization

Rasterization So the start point can be either: So the start point can be either: A projected vertex. A projected vertex. A corner of the viewport. A corner of the viewport. Algorithm: Algorithm: If any vertex has w > 0 choose a vertex as start point. If any vertex has w > 0 choose a vertex as start point. If all vertex have w <= 0 evaluate the edge equations at the four viewport corners. If all vertex have w <= 0 evaluate the edge equations at the four viewport corners. If any corner is inside choose a corner as start point. If any corner is inside choose a corner as start point.

Rasterization Pro: Pro: Seems to work... unless I have missed something. Seems to work... unless I have missed something. Cons: Cons: Traversal algorithm now must take into account that it can start anywhere. Traversal algorithm now must take into account that it can start anywhere. Increases saved state. Increases saved state.

Rasterization Hardware cost: Hardware cost: 3 x tests : w 0) 3 x tests : w 0) 3 x 2 x divs : divide by w: x/w, y/w 3 x 2 x divs : divide by w: x/w, y/w 3 x 2 comps : for choosing a vertex 3 x 2 comps : for choosing a vertex muxs additional logic for choosing a vertex. muxs additional logic for choosing a vertex. 4 x 3 evaluators: e = ax + by + c: 4 x 3 evaluators: e = ax + by + c: 2 x muls 2 x muls 2 x adds 2 x adds 4 x 3 tests: e >= 0 4 x 3 tests: e >= 0 muxs and additional logic for choosing a corner. muxs and additional logic for choosing a corner. mux and additional logic for choosing between vertices or corners. mux and additional logic for choosing between vertices or corners.

Rasterization Traversal cost for any start point/direction: Traversal cost for any start point/direction: 4 saved states: 4 saved states: 3 edge equations 3 edge equations –3 values per edge equation. Additional edge equations for other parameters? Additional edge equations for other parameters? –Z/w? Tiled traversal: Tiled traversal: 4 additional tile save states. 4 additional tile save states.

Rasterization Evaluators: Evaluators: No stamp: No stamp: –at least 4 x 3 evaluators (up, down, right, left) –at least 4 x 3 tests e >= 0. Stamped (NxM): Stamped (NxM): –at least (NxM + 4) x 3 evaluators (NxM current, up, down, right, left). –at least (NxM + 4) x 3 tests e >= 0.