mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-04 02:41:19 +00:00
12044a607b
Previously we always discarded shadow map fragments if the alpha channel of the output would have been low, but there were some (modded) assets that have non-one alpha but have testing or blending disabled so end up opaque anyway. This lets the shadows of those objects match.
29 lines
647 B
GLSL
29 lines
647 B
GLSL
#version 120
|
|
|
|
uniform sampler2D diffuseMap;
|
|
varying vec2 diffuseMapUV;
|
|
|
|
varying float alphaPassthrough;
|
|
|
|
uniform bool useDiffuseMapForShadowAlpha;
|
|
uniform bool alphaTestShadows;
|
|
|
|
void main()
|
|
{
|
|
gl_FragData[0].rgb = vec3(1.0);
|
|
if (!alphaTestShadows)
|
|
{
|
|
gl_FragData[0].a = 1.0;
|
|
return;
|
|
}
|
|
|
|
if (useDiffuseMapForShadowAlpha)
|
|
gl_FragData[0].a = texture2D(diffuseMap, diffuseMapUV).a * alphaPassthrough;
|
|
else
|
|
gl_FragData[0].a = alphaPassthrough;
|
|
|
|
// Prevent translucent things casting shadow (including the player using an invisibility effect)
|
|
if (gl_FragData[0].a <= 0.5)
|
|
discard;
|
|
}
|