# Drawing a curve with a pixel shader

This topic is 3672 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to work out how to get a pixel shader to draw a Quadratic Bezier curve based on the vertices of the current triangle it's rasterizing. I'm stuck in a number of places. 1) The Quadratic curve equation is based around the idea that at any point along the given curve, It can work out the x,y co-ordinates of that point. However, in a pixel shader I don't know how far along the curve the current pixel is, or even if it's on the curve. I somehow need to use this equation or some variation to return a true/false for if it's above or below, and preferably a distance to the curve. 2) I'm not quite sure how to transmit the positions of the surrounding three triangle verts to the pixel shader. It will probably need these to calculate the curve. If anyone knows of any decent articles that might explain some of these areas I'd appreciate it. Or even better how to do it! Cheers

##### Share on other sites

maybe this link would be useful,

I was looking in the past (and some more) at various solutions for efficient hardware-aided curve rasterization methods. Those ideas mostly focused on using the graphical hardware for accelerating the geometry generation process. But what happens, when we completely skip the geometry generation step? Even more blazing performance and totally resolution-independent rendering.

Smart curve rasterization is the first step towards efficient drawing API implementation. By combining the solution with additional dynamical GPU-programmable pipeline elements (gradients, triangulation, anti-aliasing, multi-sample rendering) we can achieve blazing-fast vector-based drawing tool.

www.mdk.org.pl/2007/10/27/curvy-blues

also,
http://www.mdk.org.pl/2007/8/16/vector-drawing-opengl-polygon-tessellation

the site seems down at the moment (for me) but the first link works with google cache

also here - but its more theoretical and supposedly slightly misleading as to exact details,
note the ip rights are already claimed
http://research.microsoft.com/~cloop/loopblinn05.pdf

##### Share on other sites
Thanks

The reason I'm looking at this is because I stumbled upon the Microsoft research paper you mentioned and read through it. It seems pretty good but in true research paper style they assume you're already a genius in the area, so some of the maths is a bit over my head.

##### Share on other sites
Insomniac Games also released a presentation about their technology for drawing curved surfaces on the PS3. It's obviously geared towards the PS3 GPU, but it should be applicable for other scenarios.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633669
• Total Posts
3013259
×