Alpha Transparency is wrong in GLB using Alphamode -1

Previous topic - Next topic

spicypixel

Overlay this smooth transparent alpha gradient over a full screen image and you will see the alpha is not smooth but has a banded edge. Try using a light coloured image to overlay on top of as it will depict the problem far better.

This needs fixing as true alpha is not being represented properly :-(

[attachment deleted by admin]
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

MrTAToad


spicypixel

Yep set to TRUE, although changing it to FALSE or completely commenting it out makes no difference :-(
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

spicypixel

This is what I get with GLB compared to Photoshop.

[attachment deleted by admin]
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

monono

Did you try using -0.9999 instead of -1?

Slydog

I noticed this same problem when adding my fake blob shadows.
They would band at the edges, no matter what alpha values I chose.

I did an experiment and found that the cut-off for the alpha was around 15 (out of 255).
Any alpha below this wouldn't render, and the first value above would show not very transparent.

I used the command 'ALPHATESTING 0' and the problem went away.
Not sure if this is set once, or per frame.

Hope this helps you in your situation.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

fuzzy70

I just tested with 'ALPHATESTING 0' & it did cure the problem.

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Slydog

Here are my before and after shots of my shadow:


[attachment deleted by admin]
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Sixth Sense


QuoteI did an experiment and found that the cut-off for the alpha was around 15 (out of 255).

Slydog, If you have the time could you expand a little on what you meant by the above please.
Okay, It's been more than ten years now so I confess............I let the dogs out!

Slydog

In my 'before' screenshot above, notice how the shadow suddenly turns to fully transparent, creating a visible line cutoff around the shadow, as opposed to a gradual fading out of the alpha as seen in the 'after' shot.

What I did to find this '15' value was in Paint.NET I created various rectangles over top of my shadow sprite.
Each rectangle had an different alpha value, gradually increasing.
You can set/view the alpha in the 'Colors' dialog.
Whenever I used a rectangle with an alpha below 15, it would not render in GLBasic.
Any alpha above this cutoff would show a transparent rectangle with a distinct edge.

Again, the '15' value is from memory, could be a little higher / lower.
I was just trying to figure out whether I was using the blurring tools properly. 
I guess I was and GLBasic was to blame! :D
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Moru

Yes, I had similar problems but this was in version 8 or so. Haven't done much with alpha since then. Alpha only changed every 8 or 16 steps, can't remember more exactly but it felt like there was a bit missing somewhere.

Slydog

Ha, ya I guess with that number 15/16 it appears to be only 4 bits, funny how I didn't notice this!
But is it only 4 bits, or does it just cut-off/ignore the lowest 15 alpha values?
The remaining gradient appears to be smooth.  (or does it?!)

But then the question is: why does 'ALPHATESTING 0' fix the problem?
Or at least APPEAR to fix the problem?
What does this command do behind the scenes?
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

erico

After you find the color space it is using, you can dither to achieve similar results maybe O_O

kaotiklabs

Using ALPHATESTING 0 has also fixed some problems with alpha not been applied with alphamode -1 .
So I dont know whats happening but it works!
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Kitty Hello

alphatesting will test and make all pixels of alpha < 0.05 be totally transparent. (no blending)