SHADE_Y3/Assets/Shaders/ShadowMap_FS.glsl

18 lines
500 B
Plaintext
Raw Permalink Normal View History

2023-02-03 20:16:42 +08:00
#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;
2023-02-03 20:16:42 +08:00
void main()
{
2023-03-04 23:12:12 +08:00
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);
2023-03-04 23:12:12 +08:00
shadowMap = vec4 (gl_FragCoord.z, moment2, 0.0f, 1.0f);
2023-02-03 20:16:42 +08:00
}