1 / 26

COMP 5411 ADVANCED COMPUTER GRAPHICS FALL 2014

Rasterization. COMP 5411 ADVANCED COMPUTER GRAPHICS FALL 2014. Rasterization. From vertices and primitives to pixels (recap and focus on GPU). Before we start. Front-faces. Back-faces. Backface culling. 2. 2. 3. 3. 1. 1. Don’t rasterize back-facing triangles

erin-lucas
Download Presentation

COMP 5411 ADVANCED COMPUTER GRAPHICS FALL 2014

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Rasterization COMP 5411ADVANCED COMPUTER GRAPHICSFALL 2014

  2. Rasterization From vertices and primitives to pixels(recap and focus on GPU)

  3. Before we start

  4. Front-faces

  5. Back-faces

  6. Backface culling 2 2 3 3 1 1 • Don’t rasterize back-facing triangles • Or front-facing, you decide • Points and lines are always rasterized • One possible implementation • Look at 2D screen coordinates • Two possible orientations • No relation to vertex normals

  7. What if triangles share an edge? Image from “Advanced Rasterization”,Nicolas Capens, 2004 • Missing or repeated fragments • Neither triangle emits, both of them emit • Cracks or overdraw (when blending)

  8. The top-left rule Image from “Advanced Rasterization”,Nicolas Capens, 2004 • Pixel center inside: emit fragment • Center on edge: emit if top edge or left edge • Top edges are horizontal and above all others • Left edges are not horizontal and are to the left • Triangles can have one or two left edges

  9. Top-rule examples Image from “Microsoft’s Direct3D 10 Rasterization Rules”, 2010

  10. Interpolation Hardware does perspective correct interpolation Vertex shader == Pixel shaderoutput structure input structure

  11. Visibility: The Z-Buffer Algorithm • Now that we have Z, we can compute visibility! • Use depth values from interpolation • Use an additional buffer to hold depth values • Render primitives in arbitrary order • Record their depths in the depth buffer • If the depth of a fragment about to be drawn is greater than what’s already there, throw it away • Image precision hidden surface removal (Covered earlier in class)

  12. Early Z culling When a fragment fails the Z-test, it can’t modify the frame-buffers What is the point of shading such fragments? Hardware tests Z first, and only runs shaderon fragments that pass the Z-test

  13. HiZ culling • Stands for Hierarchical Z culling • Hardware keeps a coarse version of Z-buffer • Stores maximum depth over a region • Entire blocks of fragments can be rejected • If min of new block larger than max of HiZ • Saves bandwidth and improves performance

  14. Keep Early Z and HiZ in mind • What happens if you modify Z inside a shader? • Early Z-culling and HiZ are disabled • Significant slowdown • What happens if you render back to front? • Early Z-culling and HiZ are ineffective • A lot of overdraw • Significant slowdown • You should try to render front to back • Counter-intuitive • Opposite of Painter’s algorithm

  15. Z-buffer optimizations • Early-Z pass optimization • Render to Z only • Render to screen only with Z-test set to “equal”

  16. Z-buffer optimizations Depth Diffuse Normals • Deferred shading • Visibility and store shading inputs on G-buffers • Shading using the buffer contentsUses a full-screen quadrilateral to render(no additional geometry pass) • Does not shade any hidden surfaces • Avoids two passes at geometry

  17. Triangle rasterization issues Images from “Triangle Rasterization” Brandon Lloyd, 2007 Sliver triangles

  18. Triangle rasterization issues Images from “Triangle Rasterization” Brandon Lloyd, 2007 Moving sliver triangles

  19. Supersampling in hardware Hardware support for higher-quality strategies FSAA, MSAA

  20. Full-scene antialiasing (FSAA) 2 samples 2 taps Sample more than once per pixel (samples) Filter to produce final pixel color (taps) There are many, many different options

  21. Full-scene antialiasing (FSAA) 2 samples 5 taps QUINCUNX Sample more than once per pixel (samples) Filter to produce final pixel color (taps) There are many, many different strategies

  22. FSAA comparison Images from “OpenGL Multisample” Sébastien Dominé, 2002

  23. FSAA comparison Images from “OpenGL Multisample” Sébastien Dominé, 2002

  24. Full-scene antialiasing (FSAA) 4 samples 4 taps RGSS 2 samples 4 taps FLIPQUAD Humans find aliasing at angles close to vertical and horizontal to be more disturbing Use pattern with more resolution for same cost

  25. Multisampleantialiasing (MSAA) • Rasterize at higher resolution • Shade at fragment resolution • Solves aliasing only across polygon edges • Which is usually more problematic • Smaller computational cost • Same memory cost

  26. Interesting new hardware functionality • Pixel shaders have access to subpixel position • Pixel shaders can set coverage mask • Pixel shaders can choose where to evaluate interpolated attributes • In other words • Rasterizer is slowly becoming programmable

More Related