Jump to content
  • Advertisement
Sign in to follow this  
theZapper

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement

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

from memory there are some shader examples given for quadratic beziers,

also,
http://www.mdk.org.pl/2007/8/16/vector-drawing-opengl-polygon-tessellation
http://www.mdk.org.pl/articles/2007/08/06/vector-drawing-opengl-shaders-and-cairo

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 this post


Link to post
Share on other sites
Thanks

I'll check those links out.

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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!