1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#version 330 core

uniform sampler2D diffuseTexture;
uniform vec3 lightPosition;

in vec2 texCoord;
in vec3 worldPosition;

layout(location = 0) out float depth;

void main()
{
    if (texture(diffuseTexture, texCoord).a < 0.2) discard;
    depth = length(lightPosition - worldPosition);
}