Halo around masked sprites

Member
Posts: 269
Joined: 2005.04
Post: #1
I've got some sprites in targa format with an alpha channel that I'm trying to draw. I use "glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );" etc like I'm supposed to and everything works fine, except that there's a white halo around the sprites. I traced it back to the fact that I'm using a linear filter on the textures (nearest works fine). Is there any way to use alpha channels like this with a linear (or better yet mipmapped) textures without the halo? The sprites will be changing sizes so I'd really rather not use nearest.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
The colors of the transparent texels of the texture should match the colors of the adjacent opaque texels.

GraphicConverter lets you see color independently from alpha, so you should be able to use it to fix this problem.
Quote this message in a reply
Member
Posts: 177
Joined: 2002.08
Post: #3
You could also use the alpha test to give the sprites sharp edges.
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #4
You are probably using photoshop to create that image.
if so you are probably cutting the pixels you what to be transparent from the file, right?.

The solution is to paint the whole picture in the desired color ( light gray may be a good choice so you can conbine with glColor4f() )

then Add a new channel to the image, then paint the area you what to show in the image with black with antialias on.
Save the image and try again that should work perfectly.

Good luck and happy coding!!Grin
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Halo-Effect in 3D OpenGL ES Bersaelor 4 5,812 Dec 17, 2009 11:54 AM
Last Post: Mark Levin
  Masked Textures Dan Potter 1 2,220 Feb 26, 2005 10:07 AM
Last Post: Dan Potter
  2D. Rendering to a Masked Texture Zwilnik 3 2,993 Mar 23, 2003 04:07 PM
Last Post: Zwilnik