28 lines
896 B
GLSL
28 lines
896 B
GLSL
|
layout(location = 0) out vec4 outColor;
|
||
|
layout(location = 1) out float outDepth;
|
||
|
|
||
|
layout(location = 0) in vec2 uv;
|
||
|
|
||
|
layout(binding = 0) uniform UniformPostData {
|
||
|
float exposure, gamma;
|
||
|
} postdata;
|
||
|
|
||
|
layout(binding = 1) uniform sampler2D texSampler;
|
||
|
layout(binding = 2) uniform sampler2D brightSampler;
|
||
|
layout(binding = 3) uniform sampler2D brightSampler2;
|
||
|
layout(binding = 4) uniform sampler2D brightSampler3;
|
||
|
layout(binding = 5) uniform sampler2D depthSampler;
|
||
|
|
||
|
void main() {
|
||
|
vec3 hdrColor = texture(texSampler, uv).rgb;
|
||
|
|
||
|
vec3 bloomColor = texture(brightSampler, uv).rgb + texture(brightSampler2, uv).rgb + texture(brightSampler3, uv).rgb;
|
||
|
|
||
|
vec3 mapped = vec3(1.0) - exp(-hdrColor * postdata.exposure);
|
||
|
mapped = pow(mapped, vec3(1.0 / postdata.gamma));
|
||
|
//mapped += bloomColor; //bugged?
|
||
|
|
||
|
outColor = vec4(mapped, 1.0);
|
||
|
gl_FragDepth = texture(depthSampler, uv).r;
|
||
|
}
|