SHADERPERMUTATION_SHADOWMAPVSDCT = 1<<19, ///< (lightsource) use virtual shadow depth cube texture for shadowmap indexing
SHADERPERMUTATION_SHADOWMAPORTHO = 1<<20, ///< (lightsource) use orthographic shadowmap projection
SHADERPERMUTATION_DEFERREDLIGHTMAP = 1<<21, ///< (lightmap) read Texture_ScreenDiffuse/Specular textures and add them on top of lightmapping
- SHADERPERMUTATION_ALPHAKILL = 1<<22, ///< (deferredgeometry) discard pixel if diffuse texture alpha below 0.5
+ SHADERPERMUTATION_ALPHAKILL = 1<<22, ///< (deferredgeometry) discard pixel if diffuse texture alpha below 0.5, (generic) apply global alpha
SHADERPERMUTATION_REFLECTCUBE = 1<<23, ///< fake reflections using global cubemap (not HDRI light probe)
SHADERPERMUTATION_NORMALMAPSCROLLBLEND = 1<<24, ///< (water) counter-direction normalmaps scrolling
SHADERPERMUTATION_BOUNCEGRID = 1<<25, ///< (lightmap) use Texture_BounceGrid as an additional source of ambient light
else
{
mode = SHADERMODE_GENERIC;
- permutation |= SHADERPERMUTATION_DIFFUSE;
- GL_BlendFunc(GL_ONE, GL_ZERO);
- blendfuncflags = R_BlendFuncFlags(GL_ONE, GL_ZERO);
+ permutation |= SHADERPERMUTATION_DIFFUSE | SHADERPERMUTATION_ALPHAKILL;
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ blendfuncflags = R_BlendFuncFlags(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
if (vid.allowalphatocoverage)
GL_AlphaToCoverage(false);
"#ifdef USESPECULAR\n"
"dp_varying mediump vec2 TexCoord2;\n"
"#endif\n"
+"uniform myhalf Alpha;\n"
"#ifdef VERTEX_SHADER\n"
"void main(void)\n"
"{\n"
" dp_FragColor.g = dp_texture2D(Texture_GammaRamps, vec2(dp_FragColor.g, 0)).g;\n"
" dp_FragColor.b = dp_texture2D(Texture_GammaRamps, vec2(dp_FragColor.b, 0)).b;\n"
"#endif\n"
+"#ifdef USEALPHAKILL\n"
+" dp_FragColor.a *= Alpha;\n"
+"#endif\n"
"}\n"
"#endif\n"
"#else // !MODE_GENERIC\n"
"#ifdef USEGAMMARAMPS\n"
"uniform sampler Texture_GammaRamps : register(s2),\n"
"#endif\n"
+"uniform half Alpha : register(c0),\n"
"out float4 dp_FragColor : COLOR\n"
")\n"
"{\n"
" dp_FragColor.g = tex2D(Texture_GammaRamps, vec2(dp_FragColor.g, 0)).g;\n"
" dp_FragColor.b = tex2D(Texture_GammaRamps, vec2(dp_FragColor.b, 0)).b;\n"
"#endif\n"
+"#ifdef USEALPHAKILL\n"
+" dp_FragColor.a *= Alpha;\n"
+"#endif\n"
"}\n"
"#endif\n"
"#else // !MODE_GENERIC\n"