Problem with ugly border in textures with alpha.

I’m having a bit of trouble with textures with alpha. It seems I always get this ugly edge around the solid (white) parts of the alpha. Does anyone have any idea what could cause this?

I first discovered it when I was trying to make a tree and saw that all the leaves had this ugly border around them. So I made this scene with a plane infront of a cube, and I put a green image with a somewhat advanced alpha on it, just so that I could see more clearly what was going on.
Here you can see the green image with the alphachannel shown next to it, and the rendered image showing the ugly edge.

Frode

Attachments



check that you have the " Full OSA" button checked in the materials buttons

Hmm… I tried again now with the Full OSA button checked (it wasn’t earlier), but the edge is still there. Although it’s a bit different than before, not as jagged. But still very visible.

Are the green image and the alpha image separate, or is the alpha image just the alpha channel of the green square?

I just tried it with two separate images, no problem. Now I am going to try it with just one image with a alpha channel.
BTW you should not have to use different images for color and alpha.

You will need to turn on ‘premul’, it is in texture settings, int the image box. That is short for premultiplied alpha, a image with premultiplied alpha stors the color r0.0 g1.0 b0.0 a0.1 as r0.0 g0.1 b0.0 a0.1

What I believe is going on is is with the button off, blender is taking the color r0.0 g0.0 b0.0 a0.0 which is what full green with 0 alpha is in premult, and deviding each color by the alpha, in order to undo premuliplcation. But this turns into a divide by zero, which givs you the bad colors.

There are advantages to premultplication, but I can’t remember them very well, try searching online.

Ah :slight_smile: Thank you very much. Turning on premultiplied alpha did the trick! I knew there had to be a simple answer to this problem, since it was so obvious that that ugly border shouldn’t be there.
And just to answer your question in the earlier post: yes, in my scene the alpha-image is the alpha-channel of the green image.

Glad to help.
You should get a job in marketing for H&R block.

Yeah, I’ll give them a sales pitch on how their logo would benefit from some transparency.