PDA

View Full Version : What rendering technique is better?


Nick32
01-28-2009, 12:07 PM
Hi!
I'm starting to develop my rendering engine using SDL.
I want to draw some complicated geometric shapes. I think approximation it with polygons is a right way. But how to render polygons effectively and with anti-aliasing?
As I see there are to ways: split polygon to triangles and render them or use more complex algorithms which can render polygons with holes and self-intersecting polygons. It is interesting to know what way better(faster, simpler to implement) and what algorithms exists?

Reedbeta
01-28-2009, 01:04 PM
Are you aiming to build a software rasterizer, or use the GPU via OpenGL? Because if you're rasterizing on a GPU, you have no choice but to use triangles, because that's all they handle. Also, modern GPUs can antialias edges as well, via a feature called multisampling.

If you're building a software rasterizer you can do whatever you want - but it still makes a lot of sense to triangulate everything. The rasterization logic can be much simpler and faster. There is plenty of code out there for triangulating complex polygons, for instance this (http://69.10.233.10/KB/recipes/hgrd.aspx).

Nick32
01-28-2009, 11:43 PM
Thank you for interesting reference. I'm going to build software rasterizer, which will not use GPU. I have implemented algorithm of triangle rasterization with anti-aliasing. This algorithm calculate coverage of pixel. I think it is similar to multisamling. Do you know how GPUs rasterize adjacent triangles? In my rasterizer there are two issues:
The first - I have to keep in memory two copies of vertexes and calculate twice slopes of edges.
Second - two adjacent edges are rasterized with anti-aliasing. It seems not effective and sometime I see bars on adjacent edges