GPU based Resolution Independent Curve Rendering

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

GPU based Resolution Independent Curve Rendering

Rami Santina
Administrator
Dear all,

today we pushed/merged an initial release of the module we have been working on lately namely, GPU based curve rendering into jogl. This module uses a new algorithm for gpu based curve rendering that is outside microsoft's Loop/Blinn patent.

Code is pushed to the jogl repo.

More about it:

blog posts:
http://jausoft.com/blog/2011/04/01/resolution-independent-gpu-accelerated-curve-font-rendering/
http://ramisantina.com/blog/?p=73

Video:
http://vimeo.com/21810192

Build:
https://jogamp.org/chuck/job/jogl/364/


Would like to hear your comments and discuss further ways to enhance & augment it.

Cheers,
Rami
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Sven Gothel
Administrator
On Friday, April 01, 2011 08:05:32 pm Rami Santina [via jogamp] wrote:

>
> Dear all,
>
> today we pushed/merged an initial release of the module we have been working
> on lately namely, GPU based curve rendering into jogl. This module uses a
> new algorithm for gpu based curve rendering that is outside microsoft's
> Loop/Blinn patent.
>
> Code is pushed to the jogl repo.
>
> More about it:
>
> blog posts:
> http://jausoft.com/blog/2011/04/01/resolution-independent-gpu-accelerated-curve-font-rendering/
> http://ramisantina.com/blog/?p=73
>
> Video:
> http://vimeo.com/21810192
>
> Build:
> https://jogamp.org/chuck/job/jogl/364/
>
>
> Would like to hear your comments and discuss further ways to enhance &
> augment it.

The current list of known issues are:

Font: Not all ttf table information is being used (hinting, ..)
  http://developer.apple.com/fonts/TTRefMan/RM06/Chap6fvar.html
  http://developer.apple.com/fonts/TTRefMan/RM06/Chap6gasp.html

  etc...

  if there are some ttf 'experts' available .. we would love to discuss

Font/Renderer: The 'Java' font rendering is buggy
  The produced outlines by the font parser are not rendered correctly.

GPU/Renderer: AMD only produces an all white picture
  tests on ATI/AMD shows that no pixel are being visible

Implementation: Enhance .. enhance
  :)

Architecture: Refine API ..
  with more use cases and discussion we shall make the API stable and more sane

To accomplish all of this we sure need everybody being interested and using it.
I will open up bugzilla entries for all of this soon.

Hope you have fun.

Cheers, Sven


>
> Cheers,
> Rami
>
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Wade Walker
Administrator
In reply to this post by Rami Santina
Wow, this looks really nice -- I'm looking forward to giving it a try

So how does it work? Are you using a tessellator to decompose the glyphs into triangles? Or a pixel shader to rasterize the curves directly? Or something else entirely?
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Rami Santina
Administrator
>> Are you using a tesselator to decompose the glyphs into triangles? Or a pixel shader to rasterize the curves directly? Or something else entirely? 
well a combination of both,
 the outlines of the glyphs are tessellated (delaunay triangulation)
but without adding any additional vertices (assuming u meant subdivision to get close to the curved shape).

Then boundary triangles where one of the vertices is off-curve go thru a pixel shader where the curve func is "computed" and a fragment is either in the region (colored) 
or out (discarded), and the "near" curve are AA'd wrt the distance to the curve. Thus getting the resolution independence :) 
ie, zooming, rotation,...etc doesn't require any cpu processing...

Cheers,
Rami

Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

gouessej
Administrator
Which minimal version of OpenGL is required?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Sven Gothel
Administrator
On Tuesday, April 05, 2011 10:32:16 am gouessej [via jogamp] wrote:
>
> Which minimal version of OpenGL is required?
>

GL2/GL3/GLES2 - GL2ES2 :)

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

gouessej
Administrator
I assume it would not be trivial to provide a fallback implementation where no pixel shader is available, am I wrong?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Sven Gothel
Administrator
On Tuesday, April 05, 2011 01:42:25 pm gouessej [via jogamp] wrote:
>
> I assume it would not be trivial to provide a fallback implementation where
> no pixel shader is available, am I wrong?

well, you could impl. the current fragment shader to render into a texture
and use that one .. if one must.

but using GPU is the the whole idea about it ..
render text, fast, resolution independent(*), in 3d space .. etc

(*) means to render is all the time at any scale / rotation - fast.
No scaling / rotation artifacts using a pre-rendered texture

~Sven

Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

gouessej
Administrator
Could the current implementation be used to render some text along isolines for example?
http://www.iwhr.com/webadmin/UploadFiles/wuhy2008714174748275.gif

I have looked at the source code a little bit, hey guys you did a great job, really :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Rami Santina
Administrator
Could the current implementation be used to render some text along isolines for example?
http://www.iwhr.com/webadmin/UploadFiles/wuhy2008714174748275.gif

Yup it can be used for that, and it can be used to render the region it self (map in this case) in a resolution independent manner.
take a look at the RegionRenderer class. and the RegionDemo

I have looked at the source code a little bit, hey guys you did a great job, really :)
thanks :) i guess we will see a use case here :)

Cheers,
Rami

Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Sven Gothel
Administrator
On Tuesday, April 05, 2011 04:04:12 pm Rami Santina [via jogamp] wrote:

>
> >
> > Could the current implementation be used to render some text along isolines
> > for example?
> > http://www.iwhr.com/webadmin/UploadFiles/wuhy2008714174748275.gif
>
>
> Yup it can be used for that, and it can be used to render the region it self
> (map in this case) in a resolution independent manner.
> take a look at the RegionRenderer class. and the RegionDemo
>
> I have looked at the source code a little bit, hey guys you did a great job,
> > really :)
>
> thanks :) i guess we will see a use case here :)

Yeah .. that sounds freaking awesome ! Nice idea Julien.
Do you have public data for such maps incl. the geometry ?

To all: The API is not yet written in stone and we may need to change it, sure.
So pls don't be shy ..

~Sven

>
> Cheers,
> Rami
>
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

gouessej
Administrator
I would like to display elevation maps, the isolines represent the contours depending on the value of a given property (the depth or something less trivial) and I need to display some text exactly on these contours, like isobars in meteorology:
http://weather.about.com/od/i/g/isobars.htm

In my case, the map is not an image, it is often very irregular, it could not be put into a texture. We have found several solutions to draw the isolines with or without shaders but the text is missing.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Rami Santina
Administrator
>>In my case, the map is not an image, it is often very irregular, it could not be put into a texture.

Perfect, which makes a great use case to the region renderer (is it coming in an SVG like file, stream,...etc)

You can create an  an com.jogamp.graph.curve.OutlineShape  from the data
and render it with
com.jogamp.graph.curve.opengl.RegionRenderer.renderOutlineShape(...);

>>I need to display some text exactly on these contours, like isobars in meteorology 
was planning to add this to the API soon, but now that you have a usecase for it, maybe we can discuss it here first...
Already added a Quaternion impl to the code base which would be the keystone to this feature.

This is basically a path animation problem, which Quaternion is, in my opinion, the best solution for it.

So as to how to render the text on the curve, (glyphs rotating along it)

We would define a start and end rotation (using quaternion) to the first glyph and the last...and any glyph in the middle (optional)
and then we would slerp between to get an interpolation between the glyphs.

This would be like Local rotation instead of the global rotation (.rotate(...) ).
In path aniamtion, you would define these quaternions on the curve it self, and when the text or object moves it get influenced by the relevant quaternions.

So how to define it from a user perspective,

my guess,
glyphString.addRotationVector(float[] upvector, float[] right); (right vector needed to know the orientation if in 3D space)

upvector - since we can create the quaternion from it internally (so a user doesnt need to understand/create quaternions)

the first rotation vector added is for the first glyph, and the last for the last...and the middle get specified as constraints.
in your case the param upvector would be the up vec at the ISO at that position.

things we would need to consider is what to do with nonRenderable glyphs (like spaces..)
 Skip in computation  or assume they are there!

what do you think? 

Cheers
Rami
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

gouessej
Administrator
Maybe a third vector could be useful to describe a full base in a non ambiguous way. Is GLSL 1.2 enough to use what you have done?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Qu0ll
This looks like some truly excellent work.

Where does the font info come from if it doesn't use AWT?

Can it be used with any arbitrary font?

Does it allow for crisp, tiny font rendering with AA?  Sub-pixel anyone?
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Sven Gothel
Administrator
On Wednesday, April 06, 2011 10:17:53 pm Qu0ll [via jogamp] wrote:
>
> This looks like some truly excellent work.
>
> Where does the font info come from if it doesn't use AWT?

We deploy the free Ubuntu fonts ..
  http://jogamp.org/git/?p=jogl.git;a=commit;h=dbcd775a7763ca131280a8341775fdfa50c4f909

We imported typecast
  http://jogamp.org/git/?p=jogl.git;a=commit;h=f8d03d8cd64593fdb24057ce928a07137b57f49f
which is now patched and moved into our namespace. Further changes to this codebase will happen.

>
> Can it be used with any arbitrary font?
TTF, OTF, .. yes.

>
> Does it allow for crisp, tiny font rendering with AA?  Sub-pixel anyone?
Well .. thats another discussion :)
As you can read above and see for yourself .. the GPU methods has it's
benefits (fast, resol.indep., cool, ..) and surely some setbacks ..
However, the 2pass FBO renderer could be used / enhanced to produce more accurate
rendering, than the 1pass renderer.

We shall open 2 new threads for his regard here to discuss it.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Qu0ll
I have had a brief play with the demo and it seems to perform poorly on my (very powerful) machine.  It takes 4-5 seconds to adjust the font size and after about 15 seconds it fails to respond to keyboard events at all and eventually clears the screen.

Also, I am unable to see the same quality of rendering as the screenshots on Rami's blog, especially with small text.  Is there something special I need to do to achieve the same levels of clarity as posted by Rami?  Small(ish) text is very fuzzy and and appears to be rendered without any AA.

Having said all that, I do realise this is the first release and it shows great potential.
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Sven Gothel
Administrator
On Thursday, April 07, 2011 10:46:29 pm Qu0ll [via jogamp] wrote:
>
> I have had a brief play with the demo and it seems to perform poorly on my
> (very powerful) machine.  It takes 4-5 seconds to adjust the font size and
> after about 15 seconds it fails to respond to keyboard events at all and
> eventually clears the screen.
>

well .. you should know the drill :)

pls send the information as described on
  http://jogamp.org/wiki/index.php/Jogl_FAQ#Bugreports_.26_Testing

(test.log)

hmm .. maybe also the log file of the test with all debug props enabled ..

> Also, I am unable to see the same quality of rendering as the screenshots on
> Rami's blog, especially with small text.  Is there something special I need
> to do to achieve the same levels of clarity as posted by Rami?  Small(ish)
> text is very fuzzy and and appears to be rendered without any AA.

Rami may have used some fine tuned parameters here and there.
Rami ?

How about your results compared to my snapshots and video ?

>
> Having said all that, I do realise this is the first release and it shows
> great potential.

Yes, we are not done yet - the infamous last 5%.
But with more collab and push, we will get there, sure.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Rami Santina
Administrator
>> Also, I am unable to see the same quality of rendering as the screenshots
>> on
>> Rami's blog, especially with small text.  Is there something special I
>> need
>> to do to achieve the same levels of clarity as posted by Rami?  Small(ish)
>> text is very fuzzy and and appears to be rendered without any AA.
>
> Rami may have used some fine tuned parameters here and there.
> Rami ?
the snapshots regarding small text uses Region.TWO_PASS
for rendering. Since in single pass we rely on MSAA which will give a
blur effect
on small/tiny size shapes (especially if skinny like text)


In the TWO_PASS  rendering, you need to specify texture size while rendering.
Which is currently not automatically computed..why, two many cases...
so left it manually for now....
to try it...(ie get same results)
run com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo02
and manipulate it using
   1/2: zoom in/out
   6/7: 2nd pass texture size
to see the effect.
Reply | Threaded
Open this post in threaded view
|

Re: GPU based Resolution Independent Curve Rendering

Rami Santina
Administrator
In reply to this post by gouessej
>>Is GLSL 1.2 enough to use what you have done?
since we are planning to run it on mobiles as well...this is based on
ES2.0 specs so...GLSL1.0 is enough.

Cheers,
Rami
12