1 / 30

Status – Week 227

Status – Week 227. Victor Moya. Summary. How to lose a week. Rasterization. Rasterization. What is the problem with w? 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 ...

elaine
Télécharger la présentation

Status – Week 227

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. Status – Week 227 Victor Moya

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

  3. Rasterization • What is the problem with w? • 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 ... • If w is < 0 then weird things happen. Wrapping around the infinite.

  4. Rasterization

  5. Rasterization A vertex with w = 0 and no clipping

  6. Rasterization A vertex with w = 0 and clipping

  7. Rasterization

  8. Rasterization A vertex with w < 0 and no clipping

  9. Rasterization Vertex with w < 0 and clipping

  10. Rasterization • That is why clipping should be mandatory ... • However using 2DH rasterization (Olano & Greer, McCool) • 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.

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

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

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

  14. Rasterization • Recursive search: • We could try to implement McCool algorithm or another similar. • 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).

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

  16. Rasterizar

  17. Rasterization

  18. Rasterization

  19. Rasterization

  20. Rasterization

  21. Rasterization

  22. Rasterization

  23. Rasterization

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

  25. Rasterization

  26. Rasterization • So the start point can be either: • A projected vertex. • A corner of the viewport. • Algorithm: • 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 any corner is inside choose a corner as start point.

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

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

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

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

More Related