SHADE_Y3/Assets/Shaders/ShadowMap_FS.glsl

18 lines
500 B
GLSL

#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require
layout(location = 0) out vec4 shadowMap;
void main()
{
float depth = gl_FragCoord.z;
float dx = dFdx(depth);
float dy = dFdy(depth);
float moment2 = depth * depth + 0.25f * (dx * dx + dy * dy);
// shadowMap = vec4 (0.0f, 0.0f, gl_FragCoord.z, 1.0f);
shadowMap = vec4 (gl_FragCoord.z, moment2, 0.0f, 1.0f);
}