• Create Account

### #ActualZlodo

Posted 31 October 2012 - 04:38 PM

Windows 7 performs font rasterization using the GPU directly
This does exactly what you want - which is drawing triangles and shading each pixel according to an implicit equation that derives from a Bezier curve
No slow and messy subdividing and drawing lines etc.

You can get a detailed description of how they do it in "Rendering Vector Art on the GPU" by Charles Loop and Jim Blinn
This is free online: http://http.develope...gems3_ch25.html

That remains quite complex though. For one, for cubic beziers it's much much easier to recursively split them into quadratic beziers than analyzing them to find out whether they're looping or whatnot to be able to rasterize them like in the paper. Quadratics are so much easier to work with, and approximating a cubic bezier with one or more quadratic is rather easy and doesn't really even result in any noticeable curvature error even when zooming in (while keeping the advantage of pixel perfect curve rendering at any zoom level).
Another thing is that you need to find overlapping "quadratic triangles" to subdivide one of them. Plus of course you need to perform tesselation of the whole thing too, but that's not really specific to using the GPU to rasterize curves.

A much easier to implement approach is to just use the stencil buffer instead of doing tesselation altogether. This also avoid the need to subdivide the "quadratic curve triangles". The downside is that each shape you need to render pretty much needs exclusive access to the stencil buffer, followed by rendering a bounding rectangle to fill the actual inside of the shape using the stencil so you pretty much require two render call for for each independent shape you want to render (and if you do stroking that's a second shape).

And then there's that, although I suspect it's quite heavy on fillrate (plus things like gradients would seem like it would be rather complex to do):
http://ivanleben.blo...r-graphics.html

Otherwise, there is an algorithm similar to bresenham but for bezier curves, which I guess is more what the OP was looking for:
http://smartech.gate...art1?sequence=1

### #2Zlodo

Posted 31 October 2012 - 04:35 PM

Windows 7 performs font rasterization using the GPU directly
This does exactly what you want - which is drawing triangles and shading each pixel according to an implicit equation that derives from a Bezier curve
No slow and messy subdividing and drawing lines etc.

You can get a detailed description of how they do it in "Rendering Vector Art on the GPU" by Charles Loop and Jim Blinn
This is free online: http://http.develope...gems3_ch25.html

That remains quite complex though. For one, for cubic beziers it's much much easier to recursively split them into quadratic beziers than analyzing them to find out whether they're looping or whatnot to be able to rasterize them like in the paper. Quadratics are so much easier to work with, and approximating a cubic bezier with one or more quadratic is rather easy and doesn't really even result in any noticeable curvature error even when zooming in (while keeping the advantage of pixel perfect curve rendering at any zoom level).
Another thing is that you need to find overlapping "quadratic triangles" to subdivide one of them. Plus of course you need to perform tesselation of the whole thing too, but that's not really specific to using the GPU to rasterize curves.

A much easier to implement approach is to just use the stencil buffer instead of doing tesselation altogether. This also avoid the need to subdivide the "quadratic curve triangles". The downside is that each shape you need to render pretty much needs exclusive access to the stencil buffer, followed by rendering a bounding rectangle to fill the actual inside of the shape using the stencil so you pretty much require two render call for for each independent shape you want to render (and if you do stroking that's a second shape).

And then there's that, although I suspect it's quite heavy on fillrate (plus things like gradients would seem like it would be rather complex to do):
http://ivanleben.blo...r-graphics.html

Otherwise, some people have come up with an algorithm kinda similar to bresenham but for bezier curves, which I guess is more what the OP was looking for:
http://smartech.gate...art1?sequence=1

### #1Zlodo

Posted 31 October 2012 - 04:33 PM

Windows 7 performs font rasterization using the GPU directly
This does exactly what you want - which is drawing triangles and shading each pixel according to an implicit equation that derives from a Bezier curve
No slow and messy subdividing and drawing lines etc.

You can get a detailed description of how they do it in "Rendering Vector Art on the GPU" by Charles Loop and Jim Blinn
This is free online: http://http.develope...gems3_ch25.html

That remains quite complex though. For one, for cubic beziers it's much much easier to recursively split them into quadratic beziers than analyzing them to find out whether they're looping or whatnot to be able to rasterize them like in the paper. Quadratics are so much easier to work with, and approximating a cubic bezier with one or more quadratic is rather easy and doesn't really even result in any noticeable curvature error even when zooming in (while keeping the advantage of pixel perfect curve rendering at any zoom level).
Another thing is that you need to find overlapping "quadratic triangles" to subdivide one of them. Plus of course you need to perform tesselation of the whole thing too, but that's not really specific to using the GPU to rasterize curves.

A much easier to implement approach is to just use the stencil buffer instead of doing tesselation altogether. This also avoid the need to subdivide the "quadratic curve triangles". The downside is that each shape you need to render pretty much needs exclusive access to the stencil buffer, followed by rendering a bounding rectangle to fill the actual inside of the shape using the stencil so you pretty much require two render call for for each independent shape you want to render (and if you do stroking that's a second shape).

And then there's that...
http://ivanleben.blo...r-graphics.html

Otherwise, some people have come up with an algorithm kinda similar to bresenham but for bezier curves, which I guess is more what the OP was looking for:
http://smartech.gate...art1?sequence=1

PARTNERS