TextRenderer: Antialiasing or Texture Filtering Issue

Howdy,

We’re using jogl to render charts, but we’re running into a bizarre issue on some desktops (winxp64 w/ Quadro FX 3500).

I’ve made sure to call GLCapabilities.setSampleBuffers(true) and .setNumSamples( 8 ) before passing it to the GLCanvas, as well as using the TextRenderer(Font font, boolean antialiased, boolean useFractionalMetrics) constructor with antialiased = true.

In the quadro images below, the text is smooth when close to the camera. However, when further away, the jaggies show up. The line edges also seem to be somewhat jagged regardless of distance.

In contrast, the geforce7600 images have smooth text regardless of distance from the camera.

Any comments / ideas?

Thanks

Matt

I believe that the TextRenderer uses textures internally to store the glyphs, so the gfx cards ability to render textures well would affect how the text appears. Looking at the quadro images, it seems that the lines of the graph background were also jaggier than on the geforce card. If that artifact isn’t because of the view, then it seems the quadro doesn’t have as good of a rasterizer. Are there any different texture parameters that you’d be using on the different cards?

Thanks Bob,

> Looking at the quadro images, it seems that the lines of the graph background were also jaggier than on the geforce card.

Yep, the lines rendered on the Quadro card also appear jaggier than on the geforce. This surprises me because the Quadro cards are supposedly made for higher-end graphics workstations. (the Geforce 7600 is in my laptop)

> Are there any different texture parameters that you’d be using on the different cards?

I’d like to be able to experiment with the texture filter parameters for the TextRenderer, but I don’t believe they expose this in the api.

It’s also worth noting that:
[1] the jogl demos that use TextRenderer’s draw3d() method aren’t filtered/antialiased. (e.g. the TextCube demo which draws text on the faces of a cube)
[2] the demos that use the draw() method are filtered/antialiased properly

We’ve installed the latest nvidia winxp64 driver for the quadro card, but the nvidia tray/console options window doesn’t seem to affect the result. (there’s a slider bar for “quality”)

Matt

I was referring to texture parameters that you’ve set external to TextRenderer. If you’re using texture objects I doubt this could be a problem, but maybe a min or mag filter setting was set on the default texture. Another thing to check is to see if the textures are marked as mipmap complete, or if the min or mag filters were somehow set to GL_NEAREST instead of LINEAR (I’m not sure how that is, I’m reaching for a fixable solution besides it’s a bug in their drivers).

[quote]I was referring to texture parameters that you’ve set external to TextRenderer. If you’re using texture objects I doubt this could be a problem, but maybe a min or mag filter setting was set on the default texture.
[/quote]
I don’t believe any of the opengl methods we’re calling would alter the texture state variables (no textures bound/used, and no calls to glTexParameter). The TextRenderer’s “smooth” boolean defaults to true, which I think controls whether GL_LINEAR is used.

The only semi-relevant features we’re using are things like the blending function and smoothing hints (although the TextRenderer artifacts appear to be purely related to the filtering function).

We can see the aliasing/jagged behavior in the jogl TextCube demo, so I think that might be the best indicator that there’s something going on either at the library or driver level. Any chance that the filter function might be set to NEAREST in the TextRenderer or its RenderDelegate?

http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/TextCube.jnlp
(we had to modify this demo to slow it down to observe the jaggies)

It sounds like the reasonable next step is to run some other 3d app on that hardware & verify that we get correct texture filtering & antialiasing behavior. Maybe there are some opengl demos out there that tweak the filter parameters (nehe?).

Ok, a followup:

I ran a textured-font demo on both the geforce & quadro gpus, and see good filtering on both (see attached).

Demo: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=24
Download: http://nehe.gamedev.net/data/lessons/vc/lesson24.zip

The demo uses the GL_LINEAR filter parameter:
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

Any ideas why we are seeing good filtering behavior in this demo and not in the above chart renderings?

Looking at those chart images, the aliasing artifacts seem to appear only when the minification filter is applied, since the text of the country names appear jagged when distant from the camera, but appear smooth when very close (e.g. the “a” in Venezuela).

Thanks again for any help, this is one of the last lingering issues we’re trying to resolve.

By default, I believe the TextRenderer uses linear filtering. Try playing around with setSmoothing(true or false) or telling your TextRenderer object to use mipmaps when you construct it. Setting setSmoothing(true) should use linear filters, false will use nearest. It will be interesting to see if the quadro has any visual changes between the two.

setSmoothing() also came with this documentation:

 * Sets whether smoothing (i.e., GL_LINEAR filtering) is enabled
     * in the backing TextureRenderer of this TextRenderer. A few
     * graphics cards do not behave well when this is enabled,
     * resulting in fuzzy text. Defaults to true.

I’m not sure if this is what you’re seeing, or if there is a workaround that still provides nice text.

[quote]Try playing around with setSmoothing(true or false)
[/quote]
I tested the smoothing property on the Quadro desktop, but I couldn’t see any difference between the true & false settings.

When I enabled mipmaps, it improved the filtering behavior significantly. However, there’s a very noticeable pause during initialization (lasting a couple of seconds) which will prevent us from using this option.

As for the “fuzzy” text comment in the docs, I think it’s best described as “aliased” or “unfiltered”. The only other way I can see to debug this is to play around with the TextRenderer source & see if we can get better behavior by altering the texture parameters. Hate to write it off simply as a “driver issue” without knowing definitively if I’m doing something wrong.

If anyone has any comments, don’t hesitate to post

Thanks