GPU based Resolution Independent Font & Curve Rendering – initial Release

Below is about the latest project done by Sven Gothel and myself, which is now published/merged in JogAmp – Jogl Project.

The story: At first we started this project as an idea, started with a chat with Sven on possible ways to by pass the Microsoft patent on GPU Curve Rendering. So after digging into the math of Loop/Blinn patent, devised a way to solve the problem with a different approach than the one used in the patent, the math behind the new approach will be published here soon (need to type them, currently on a notebook with too many scrabble).

After making sure the math works in theory, moved into developing a prototype for the algorithm. While doing this, developed a tessellation utility to provide Delaunay based triangulation of the curved outlines, mainly to avoid using a hack on GLU tessellation to get the triangles and not to have a slow solution. After having a working version of the demo, we went into the “harder” part, getting good quality AA on the ever so tiny fonts. After lots of discussions and fighting the small dimples in the curves, we were able to devise a method that provided the best output of all the others we tried and sharp quality Anti Aliasing.

At that point, we moved from building a prototype (proof of concept) to building an API so that we can add it to JOGL API, which was a great experience by it self, thinking of all the ways the user might wanna use it.  We looked into making it more generic, usable, readable, and stable for a user. Not to forget making sure all the code is BSD license clean.

Yesterday, we reached to a point where we agreed that its “clean” and good for an initial public release, merge with jogl project.  More than enjoying the results and outcomes the best part was the collaboration and the discussion held during the project development.  In short it was a great experience, and lots of fun!

As for the tech part: first some new snapshots,

(click image to view)

Text with two pass AA

Text with two pass AA

Font Set showing all the glyphs in two pass rendering

Font Set showing all the glyphs in two pass rendering

Manually Defined Region - One Pass

Manually Defined Region - One Pass

Small text string - Two Pass Rendering

Small text string - Two Pass Rendering

…as a continuation to the earlier post, we have cleaned up the repository of the curve rendering module, and now merged into jogamp.org – jogl project. (git sub-tree merge ).
The text and region renderer, have two rendering types defining the rendering Technique (SINGLE_PASS or TWO_PASS).

Single Pass: the region with no AA for the straight edges and general shape, where only the curved regions have implicit AA function embedded in the calculations in the relevant fragment shader. This type of rendering is useful for most cases where AA quality on very small fonts/regions is not important. Example usage would be having text scattered around in a 3D scene. The developer is then free to use/plug in his post processing or just use MSAA which gives good results in most cases.

Two Pass: (check the pictures above) render the region to an FBO and then in a second pass attach it to the Bounding Box of the String and do a variant of a Gaussian blur on the text/region. Giving the ever sharp effect on the text that can’t be accomplished in a single pass rendering (at least all the other approaches that I tried). The sharpness of the final shape is dependent on the variable texture size for the first pass (giving the user a way to play with the effect: blurry to sharp). Note: later this will be available in an automatic manner. (hopefully not too later)

To see details on how to use it you can take a look at the unit tests, and demos also pushed to the jogl repository.

https://github.com/sgothel/jogl
https://github.com/rsantina/jogl

Having said all that, download the latest jogl build and try the demos,
would love hearing your feedback and ideas.

Cheers

, , , , , , , , ,

11 Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>