Jump to content
  • Advertisement
Sign in to follow this  
Scoob Droolins

Using gatheralpha for alpha test - problem with BC3 (DXT5) textures

This topic is 1199 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi - I've implemented a pretty effective alpha test using Texture2D.GatherAlpha, works even better with alpha-to-coverage enabled.  If it gets past the clip(), i multiply the scalar alpha return value with the final color.

cbuffer PAlphaTest : register (cb2)
{
  float4 alphaTestThresh;
};

float MainSampleAlphaTest (Texture2D tex, SamplerState samp, float2 texCoord)
{
  float4 alphaSamp = tex.GatherAlpha (samp, texCoord, int2(0,0));
  float alpha = dot (alphaSamp, 0.25);
  clip (alpha - alphaTestThresh.x);
  return (alpha);
}

WIth a DXGI_FORMAT_R8G8B8A8_UNORM_SRGB texture I get this:

 

[attachment=28982:a0.jpg]

 

WIth a DXGI_FORMAT_BC3_UNORM_SRGB texture I get this:

 

[attachment=28983:a1.jpg]

 

Strange bunch of lines with the BC3 texture - anyone seen this effect before?

Thanks.

 

Share this post


Link to post
Share on other sites
Advertisement

I've seen driver bugs in the past when gather is involved. Did you test that you actually get the proper results if you issue four regular samples?


I agree, it sounds like a driver bug. You can also try using the reference device to see if that produces the correct results. If it does, then it's probably a driver bug.

Share this post


Link to post
Share on other sites

Thanks for all your replies.  The good news is, not a driver bug - this was my bug, a cross-up in identifying the texture format.  The DXT5 was being loaded as BC2 intead of BC3.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!