GL Blending Question

⌘-R in Chief
Posts: 1,277
Joined: 2002.05
Post: #1
See the faint glow/fuzz around the one the right? What's going on? The one on the left is the original png layered on top of the screenshot in Photoshop.


[Image: upshot_qrkDnKZO.jpg]
Quote this message in a reply
Posts: 1,234
Joined: 2002.10
Post: #2
Looks like somewhere between Photoshop and your image loader, you got pre-multiplied pixels. So all pixels with alpha are "too dark" with that blend equation.

This can happen if you use CoreGraphics to load images.
Quote this message in a reply
Posts: 6
Joined: 2011.06
Post: #3
It looks like the pixels in your texture with low opacity have RGB of 255,255,255. This is done to improve compression but I thought this was only done only for pixels with 0 opacity (still a problem when using linear sampling), but in the image it looks like it is happening for all those with 'low' opacity.
Yes, you need to look into "pre-multiplied alpha". It is a perfect solution and not too dfficult to understand.
All you need to do is multiply all rgb values by the alpha when loading the image, and use this blend function instead:
It 'should' magically solve your problem.

"I just want to program!"
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  general blending versus texture blending questions WhatMeWorry 2 6,487 Dec 7, 2006 02:43 PM
Last Post: arekkusu