iDevGames Forums
Smoothing out curved aliased texture edges - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Smoothing out curved aliased texture edges (/thread-4702.html)

Smoothing out curved aliased texture edges - WhatMeWorry - Dec 15, 2005 02:54 AM

I posted a similar question, but at the time my brain was still fuzzy
and I think it was so poorly worded, that most readers probably
thought I was babbling.

Here's the problem. Or maybe this is not a problem but simply a
limitation that I'll have to live with. Which is why I'm posting here.
I've tried to simplify everything to the bare essence.

Ok, lets say I've got and 256x128 RGBA texture of an oval. Naturally,
the texture is a rectangle of data, but with the alpha transparency users
only see an oval displayed.

In my game, I resize my texture object (scale up the texture coordinates);
or move my camera closer to the oval). That should be equivalent in OpenGL.

Now then, when the camera moves close to the oval; or the texture
is rescaled to a large size, the curved edges of the oval is naturally very
jagged. Or more pixilated that I would like it to be.

Now, I've got a very dog-eared copy of the red book. But I don't know
which techniques would help smooth out the aliasing. I do have the GL_TEXTURE_MAG_FILTER set to GL_LINEAR, which the read book
says "provides smoother results".

But beyond that I'm clueless.

For instance, would screen anti-aliasing help matters or would it
be a comple kludge.

Will making the texture larger, say 512x256, or 1024x512 improve things?

The RGBA texture data is generated in Photoshop. Can I do something
in Photoshop with the image before incorporation into my game?

Any suggestions to help my case of the "jaggies" will be much appreciated.


Smoothing out curved aliased texture edges - Bachus - Dec 15, 2005 03:08 AM

Obviously make sure the texture edges are anti-aliased. GL_LINEAR is the proper texture filter. And of course, if you need to zoom in on a texture you're going to notice the jaggies. The only way to fix that is with larger textures.

It's handy to have larger than needed textures so that you can offer multiple texture quality settings. Low-quality textures for those with slower cards with less memory, and higher-quality textures for those with bad ass cards that make everyone else green with envy. Of course, you also have to ask yourself, is anyone actually going to notice a couple small jaggies on this one texture?

Smoothing out curved aliased texture edges - dfmoore - Dec 15, 2005 05:11 AM

also, take a look at gluBuild2DMipmaps. this will dynamically create a series of images at smaller progressions that will get used depending how far the image is away from the viewer, automatically. So, you can pass in a larger image and it'll decide on the fly what level of detail to actually try to display, which can save you a lot of performance, and only take up the video memory of your image plus one third. I think its a good deal for what you're trying to do.

possible improvements on this include (as heralded from the superbible):
gluBuild2dMipmapLevels which gives you finer control of the mipmap creation
where # tells openGL how sensitive to be when deciding when to start showing lower res images rather than the larger ones. (so you can decide your own lookin' good vs runnin' good trade-off point.)

...and "trilinear mipmapping" via GL_LINEAR_MIPMAP_LINEAR.

talking too much more about this is putting me on shakey ground, so i'll let the smarter forum members set me right if this isn't what you're asking for or if i've screwed up in what i've suggested...