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

DXT1 compression forces RGB to 0 when alpha bit is 0 #12

Open
GoogleCodeExporter opened this issue Sep 9, 2015 · 1 comment
Open

DXT1 compression forces RGB to 0 when alpha bit is 0 #12

GoogleCodeExporter opened this issue Sep 9, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Convert a R8G8B8A88 texture to DXT1 using squish
2. Look at the compressed texture in your engine with bilinear filtering 
enabled onto the sampler or alpha test turned off

What is the expected output? What do you see instead?
The rgb values of the texture are forced to 0 where alpha < 128
This is a problem since when discarding texels with clip(tex-0.5) then the 
rgb values are bleeding to black.

What version of the product are you using? On what operating system?
I checked the last version the code is always the same.

Please provide any additional information below.
I locally removed theses lines:

// check for transparent pixels when using dxt1
/*if( isDxt1 && rgba[4*i + 3] < 128 )
{
  m_remap[i] = -1;
  m_transparent = true;
  continue;
}*/

and 

check for a match
int oldbit = 1 << j;
bool match = ( ( mask & oldbit ) != 0 )
&& ( rgba[4*i] == rgba[4*j] )
&& ( rgba[4*i + 1] == rgba[4*j + 1] )
&& ( rgba[4*i + 2] == rgba[4*j + 2] )
/*&& ( rgba[4*j + 3] >= 128 || !isDxt1*/ );

in coulourset.cpp

Then it works as expected... So I really wonder if the DXT1 formats 
*needs* that to be done or if this is known bug? 

I tested textures converted with that fix onto a PC with GTX260/dx9 and 
playstation 3 and xbox 360 it worked fine on all platforms.




Original issue reported on code.google.com by [email protected] on 9 Mar 2010 at 9:49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant