Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
graphite/dist/shaders/post.frag

28 lines
896 B
GLSL
Raw Normal View History

2024-01-03 16:05:02 -05:00
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;
}