Vexator
05-02-2007, 01:21 AM
i want to support alpha-masked materials for my shadow maps, so i discard all fragments with an alpha value less than 0.5 in the fragment shader:
varying vec2 v_Coordinates;
uniform bool u_UseTexture2;
uniform sampler2D u_Texture2;
void main()
{
// handle transparency
if( u_UseTexture2 )
{
if( texture2D( u_Texture2, v_Coordinates ).r < 0.5 )
discard;
}
}this works fine, but is horribly slow! fps drop from 100 to 25 (compared to the same scene without discarding framents). i do the same in my lighting shader and it doesn't have any performance impact at all. any idea what's wrong?
EDIT: if i use GL_ALPHA_TEST instead, there is no performance hit - why?
varying vec2 v_Coordinates;
uniform bool u_UseTexture2;
uniform sampler2D u_Texture2;
void main()
{
// handle transparency
if( u_UseTexture2 )
{
if( texture2D( u_Texture2, v_Coordinates ).r < 0.5 )
discard;
}
}this works fine, but is horribly slow! fps drop from 100 to 25 (compared to the same scene without discarding framents). i do the same in my lighting shader and it doesn't have any performance impact at all. any idea what's wrong?
EDIT: if i use GL_ALPHA_TEST instead, there is no performance hit - why?