transparency: alpha vs. add_color
transparency: alpha vs. add_color
hi,
i've got a problem with transparency. look at the following screenshot:
http://fahrschule-piepenbrock.de/morris ... arency.jpg
the left one is a *.png file with an alpha channel, the right is a jpg with black background. i think you can see that with alpha, the borders are quite glitchy in my opinion, and with additive color it looks pretty neat to me. of course, additive color takes away all darker colors, which i'd really hate but on the other hand its just too ugly.
does anybody know why this is the case? i need a way to make alpha transparency look better. i've already tried to play around with Material::MaterialTypeParam, which changes something in the alpha, but all values look bad.
i've got a problem with transparency. look at the following screenshot:
http://fahrschule-piepenbrock.de/morris ... arency.jpg
the left one is a *.png file with an alpha channel, the right is a jpg with black background. i think you can see that with alpha, the borders are quite glitchy in my opinion, and with additive color it looks pretty neat to me. of course, additive color takes away all darker colors, which i'd really hate but on the other hand its just too ugly.
does anybody know why this is the case? i need a way to make alpha transparency look better. i've already tried to play around with Material::MaterialTypeParam, which changes something in the alpha, but all values look bad.
yes, they are both 256x256. i should have mentioned that they are not GUIImages, and are not drawn using draw2dImage. they are used as materials on a face (which is, at the time of the screenshot, parallel to the viewport). they are both scaled as if they were textures on a mesh, but still additive color is looking a lot better than alpha transparency.
xDan probably meant anti-aliasing. This may help if your textures aren't anti-aliased already.
Also you may try setting SMaterial::MaterialTypeParam and play with it:
Also you may try setting SMaterial::MaterialTypeParam and play with it:
And you may want to try out EMT_TRANSPARENT_ALPHA_CHANNEL_REF material type too.SMaterial::MaterialTypeParam. If set to 0, the alpha ref gets its default value which is 0.5f and which means that pixels with an alpha value >127 will be written, others not. In other, simple words: this value controls how sharp the edges become when going from a transparent to a solid spot on the texture.
they ARE anti-aliased, they're not done in paint they wouldnt look good with additive color if they weren't, i think.arras wrote:xDan probably meant anti-aliasing. This may help if your textures aren't anti-aliased already.
as i said before, i've already tried that. in fact, it helps for lighter colors, but everything dark will have weird highlighted borders (opengl):arras wrote:Also you may try setting SMaterial::MaterialTypeParam and play with it: SMaterial::MaterialTypeParam. If set to 0, the alpha ref gets its default value which is 0.5f and which means that pixels with an alpha value >127 will be written, others not. In other, simple words: this value controls how sharp the edges become when going from a transparent to a solid spot on the texture.
http://fahrschule-piepenbrock.de/morris ... rency2.jpg
and this wouldnt convince me to use alpha. EMT_TRANSPARENT_ALPHA_CHANNEL_REF is _much_ worse than both other options, it has hard and ugly edges and still some highlighted borders.
Did you tried to turn off mip-map generation before loading those textures? It can be done in IVideoDriver::setTextureCreationFlag() but must be done before textures are loaded from file. If I remember right there is somewhere also way how to check if texture have mip-maps.
Not sure if it can help however...
Not sure if it can help however...
But are they anti-aliased to transparent (if that makes sense...)?they ARE anti-aliased, they're not done in paint Wink they wouldnt look good with additive color if they weren't, i think.
(I mean, you could have done the anti aliasing while you still have a black background or something, then filled the background as transparent afterwards. That would look bad with alpha but ok as additive)
Sorry I'm repeating myself, it's just that it looks like a problem I had once.
You could upload the texture...
@xDan:
anti-aliasing is done automatically by photoshop; i delete the background layer and draw things on an empty layer. this way i get anti-aliasing to "transparency".
also, if i put the png into a GUIImage it looks perfect - so anti-aliasing should be alright.
@arras: turning off mipmaps didnt make any difference
edit: here's the texture: http://fahrschule-piepenbrock.de/morris/test.png
anti-aliasing is done automatically by photoshop; i delete the background layer and draw things on an empty layer. this way i get anti-aliasing to "transparency".
also, if i put the png into a GUIImage it looks perfect - so anti-aliasing should be alright.
@arras: turning off mipmaps didnt make any difference
edit: here's the texture: http://fahrschule-piepenbrock.de/morris/test.png