1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-29 03:19:44 +00:00
OpenMW/files/shaders/compatibility/shadowcasting.frag

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
858 B
GLSL
Raw Normal View History

#version 120
#if @useGPUShader4
#extension GL_EXT_gpu_shader4: require
#endif
uniform sampler2D diffuseMap;
varying vec2 diffuseMapUV;
varying float alphaPassthrough;
uniform bool useDiffuseMapForShadowAlpha;
uniform bool alphaTestShadows;
2023-02-25 19:03:39 +00:00
uniform float alphaRef;
2023-02-25 19:03:39 +00:00
#include "lib/material/alpha.glsl"
void main()
{
gl_FragData[0].rgb = vec3(1.0);
if (useDiffuseMapForShadowAlpha)
gl_FragData[0].a = texture2D(diffuseMap, diffuseMapUV).a * alphaPassthrough;
else
gl_FragData[0].a = alphaPassthrough;
2023-02-26 22:31:41 +00:00
gl_FragData[0].a = alphaTest(gl_FragData[0].a, alphaRef);
// Prevent translucent things casting shadow (including the player using an invisibility effect).
// This replaces alpha blending, which obviously doesn't work with depth buffers
if (alphaTestShadows && gl_FragData[0].a <= 0.5)
discard;
}