Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwanted Transparency #1815

Closed
Istenes opened this issue May 8, 2014 · 8 comments
Labels
bug

Comments

@Istenes
Copy link

@Istenes Istenes commented May 8, 2014

Hello!
We've noticed that every single sprite in our sprite batch is transparent, but we are pretty sure that every asset we use isn't. I don't have any screen shots atm, but will upload as soon as possible, but I've heard that this is a know bug not related to libgdx?

Where should I file this bug report?

Cheers!

@NathanSweet

This comment has been minimized.

@badlogic badlogic added the bug label May 8, 2014
@JRRG

This comment has been minimized.

Copy link

@JRRG JRRG commented May 9, 2014

I commented this issue in forums. You can check screenshots.
http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=13937

@badlogic

This comment has been minimized.

Copy link
Member

@badlogic badlogic commented May 10, 2014

Thanks for raising this one. @kallehamalainen had an interesting idea to fix this issue, we can simply scale alpha in the shader.

My proposal: on the CPU side (SpriteBatch#setColor, Sprite#setColor, a million other places) we do nothing. We already mask the float representations of the 32-bit int colors to the range 0-254 in the alpha channel. In the vertex shader we can then simply upscale that range to 0-255 as Kalle suggest.

@MobiDevelop @NathanSweet objections? I'd also like to have a test case for this one.

@NathanSweet

This comment has been minimized.

Copy link
Member

@NathanSweet NathanSweet commented May 10, 2014

Sounds good.

@MobiDevelop

This comment has been minimized.

Copy link
Member

@MobiDevelop MobiDevelop commented May 10, 2014

Sounds OK to me. As was noted on the forum post, everything else will have a slightly higher alpha than intended, but probably wouldn't be as noticeable as a non-opaque sprite when you are expecting opaque.

@badlogic

This comment has been minimized.

Copy link
Member

@badlogic badlogic commented May 10, 2014

Jupp, that's my reasoning as well. The important cases are alpha = 0 and
alpha = 1, which would both work with this fix.

On Sat, May 10, 2014 at 3:16 PM, Justin Shapcott
notifications@github.comwrote:

Sounds OK to me. As was noted on the forum post, everything else will have
a slightly higher alpha than intended, but probably wouldn't be as
noticeable as a non-opaque sprite when you are expecting opaque.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1815#issuecomment-42741456
.

@badlogic

This comment has been minimized.

Copy link
Member

@badlogic badlogic commented May 10, 2014

fixed as described for SpriteBatch/SpriteCache. If someone uses their own custom shader, they'll have to fix things up themselves.

@badlogic badlogic closed this May 10, 2014
@macmata macmata referenced this issue Jun 27, 2014
@vmilea

This comment has been minimized.

Copy link
Contributor

@vmilea vmilea commented Oct 29, 2014

@badlogic Shouldn't it be 255.0/254.0 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.