openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.97k stars 2.55k forks source link

Bezier Shaders & Vector openGL rendering #1190

Open microbians opened 12 years ago

microbians commented 12 years ago

I'm investigating the way to draw bezier curves / nurbs etc. with shaders, here is a list a links and information I found that can improve render times with OF. Any way I must admit I'm new to openGL & shaders so maybe someone can take this to implement maybe an add-on or maybe to added to the core.

Resolution Independent Curve Rendering using Programmable Graphics Hardware http://research.microsoft.com/en-us/um/people/cloop/loopblinn05.pdf

Resolution independent GPU accelerated Curve & Font rendering GPU based Resolution Independent Font & Curve Rendering – initial Release http://jausoft.com/blog/2011/04/01/resolution-independent-gpu-accelerated-curve-font-rendering/ http://ramisantina.com/blog/?p=73 http://vimeo.com/21810192 http://jogamp.org/doc/gpunurbs2011/p70-santina.pdf

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

Vector drawing: OpenGL shaders and cairo & vector hardware tessellation http://www.mdk.org.pl/2007/8/6/vector-drawing-opengl-shaders-and-cairo

ShivaVG & Random Access Rendering of Animated Vector Graphics http://ivanleben.blogspot.com.es/2007/07/shivavg-open-source-ansi-c-openvg.html http://www.youtube.com/watch?v=mD8X-e5-sY4 http://www.youtube.com/watch?v=U4USCfwORUg http://andrejas-atelier.com/ivan/IvanLebenHonsThesis.pdf

RAVG http://research.microsoft.com/en-us/um/people/hoppe/proj/ravg/

NV Path Rendering Videos (seams only with nvidia) http://developer.nvidia.com/nv-path-rendering-videos

Vector drawing: OpenGL polygon tessellation http://www.mdk.org.pl/2007/8/16/vector-drawing-opengl-polygon-tessellation http://zrusin.blogspot.com.es/2006/07/hardware-accelerated-polygon-rendering.html

kylemcdonald commented 12 years ago

wow, crazy list!

are there some specific shortcomings of rendering in OF that you think we could really improve?

i mean, there are always going to be optimizations for everything... but is there a specific situation where you were having a problem rendering things as fast as you needed?

also: i changed this from section-internals to section-2D even though there is no 2D leader at the moment.

bilderbuchi commented 12 years ago

also: i changed this from section-internals to section-2D even though there is no 2D leader at the moment.

good call on that, probably better that way :-)

microbians commented 12 years ago

I think could be a good improvement to render 2D vector graphics for example over the iOS/Android implementations with openGL ES 2 will open a lot of new options (vector drawing apps, resolution independent UI,...)

In my specific case, I'm working now on the port of an drawing app I done time ago. The idea is a drawing app with realistic strokes but not raster, I would like to do it in vector because the idea is to have the ability to print it or used at any resolution. That's will be a lot of bezier strokes in screen that will need events (for delete individually or correct them). Here is the current version of the drawing app working in flash that works fine, but I know will be better in OF. https://vimeo.com/37916074 (Soon I will release this old flash version and a math paper about variable-width strokes with beziers)

Anyway I'm new to shaders but I will try start working on it.

bilderbuchi commented 12 years ago

Hey sounds/looks great. would be interested in reading that paper, drop me a line when you publish! btw, such a variable stroke width implementation sounds like it could be really useful for www.inkscape.org.

yangjin commented 12 years ago

skia gpu backend has implemented the GPU vector rendering.

kylemcdonald commented 12 years ago

@yangjin skia looks incredible https://code.google.com/p/skia/ thanks for the reference. have you worked with it in OF before?

microbians commented 12 years ago

Works on iPad http://www.youtube.com/watch?v=Rs7sVbPnFxk

yangjin commented 12 years ago

I haven't worked with it. Just recommended for your reference. Currently Skia GPU backend has been used to accelerated Chrome browser for 2D drawing.

remoe commented 12 years ago

Is there any alternative for this dead link http://andrejas-atelier.com/ivan/IvanLebenHonsThesis.pdf ?

microbians commented 11 years ago

Hi everybody again :+1:

I found looking for some stuff related with Haxe, this library:

MonkVG is an OpenVG 1.1 like vector graphics API working over OpenGL ES 1.1 and 2.0

https://github.com/micahpearlman/MonkVG

Hope this will be useful.

bgstaal commented 11 years ago

This list of resources is great! I've been looking for ways to draw nice, thick lines, without having to use a cpu based library like cairo/quartz/qt.

I have started an addon for openframeworks based on Ivan Leben's OpenVG implementation (from one of the links posted above). You can find it here:

https://github.com/bgstaal/ofxShivaVG

microbians commented 11 years ago

Looks awesome!!

lehni commented 10 years ago

Another document for the list above:

http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/opengl/gpupathrender.pdf

microbians commented 10 years ago

Hi guys, here is the first part of three math papers I'm working on. The first is about "Quadratic bezier offsetting with selective subdivision" I think that taking in consideration the fast quadratic bezier can be done with shaders, this can help in the offsetting and paint of better quadratic bezier strokes with shader-quadratic-bezier-patches... In a few days I will release a more clear pseduo-code or at last the actionscript I'm using in the example, that can be ported easily. But first of all sorry because my english not good enough.

"Quadratic bezier offsetting with selective subdivision" http://microbians.com/?page=math

Here is also some playground with an implementation (flash): http://microbians.com/?page=code&id=code-bezieroffsetingplayground

Please let me know if you found interesting ;)

PD: This is a beta app using the variable width version of the algorithm: http://microbians.com/?page=code&id=code-theelectronicsketchbook

arturoc commented 10 years ago

yeah, looks really great, i have a geometry shader that does thick lines for line segment only if we could port this to a geometry shader too we could have thick lines and tessellation in the gpu for any outline path without relying on any external api, at least with the programmable renderer

tgfrerer commented 10 years ago

Amazing work! i wonder how hard it might be to port it to a geometry shader, a la:

https://forum.libcinder.org/topic/smooth-thick-lines-using-geometry-shader

Or maybe to a tesselation shader, for OpenGL 4+

It would be fantastic to have hardware-accelerated thick bezier lines in OpenGL!

microbians commented 10 years ago

Thanks :) Hope to post the pseudo-code soon this week. I must finish before the PDF composition of two other related papers yeah!

ghost commented 9 years ago

@remoe Ivan Leben's masters thesis is available from his personal repo. I know it's been a few years, but I hope others arriving via Google will find this link helpful.

pizthewiz commented 9 years ago

NanoVG is another great and compact lib for antialiased vector shape rendering into OpenGL - it supports OpenGL 2, OpenGL 3.2 core profile, OpenGL ES 2 and OpenGL ES 3.

microbians commented 9 years ago

NanoVG looks promising !

tyoc213 commented 9 years ago

@remoe I think this is it https://github.com/ileben/HonoursThesis for http://andrejas-atelier.com/ivan/IvanLebenHonsThesis.pdf