Smoothing out curved aliased texture edges

Posts: 321
Joined: 2004.10
Post: #1
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.

Quote this message in a reply
Posts: 269
Joined: 2005.04
Post: #2
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?
Quote this message in a reply
Posts: 68
Joined: 2005.09
Post: #3
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...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Preventing texture from creating transparent gaps on edges ardowz 3 1,302 Jan 21, 2014 11:28 AM
Last Post: SethWillits
  Create Aquaria-like terrain- texturing edges AndyKorth 3 6,248 Jul 31, 2011 08:13 PM
Last Post: FlamingHairball
  [SOLVED]OpenGL edges of textures mk12 2 4,363 Sep 2, 2010 08:07 PM
Last Post: mk12
  Replacing edges with degenerate quads (for shadow volumes) Coyote 9 7,669 Jan 15, 2010 07:08 PM
Last Post: Coyote
  Anti-aliased bitmapped fonts Jake 12 6,735 Nov 19, 2007 05:02 PM
Last Post: Jake