diff --git a/include/limitless/renderer/composite_pass.hpp b/include/limitless/renderer/composite_pass.hpp index cd4d7984..3a0b4ddf 100644 --- a/include/limitless/renderer/composite_pass.hpp +++ b/include/limitless/renderer/composite_pass.hpp @@ -18,6 +18,7 @@ namespace Limitless { Framebuffer framebuffer; public: float tone_mapping_exposure = 1.0f; + float gamma = 2.2f; explicit CompositePass(Renderer& renderer); diff --git a/shaders/pipeline/composite.frag b/shaders/pipeline/composite.frag index ee768d78..3c63fbcf 100644 --- a/shaders/pipeline/composite.frag +++ b/shaders/pipeline/composite.frag @@ -12,6 +12,7 @@ uniform sampler2D bloom; uniform sampler2D outline; uniform float bloom_strength; uniform float tone_mapping_exposure; +uniform float gamma; void main() { vec3 bloom_color = texture(bloom, uv).rgb * bloom_strength; @@ -21,7 +22,6 @@ void main() { color = toneMapping(color, tone_mapping_exposure); // apply gamma correction - float gamma = 2.2; color = pow(color, vec3(1.0 / gamma)); // add objects outlining diff --git a/src/limitless/renderer/composite_pass.cpp b/src/limitless/renderer/composite_pass.cpp index f0c832d9..21c0241b 100644 --- a/src/limitless/renderer/composite_pass.cpp +++ b/src/limitless/renderer/composite_pass.cpp @@ -46,7 +46,8 @@ void CompositePass::render( shader.setUniform("bloom", bloom_pass.getResult()) .setUniform("outline", renderer.getPass().getResult()) .setUniform("bloom_strength", bloom_strength) - .setUniform("tone_mapping_exposure", tone_mapping_exposure); + .setUniform("tone_mapping_exposure", tone_mapping_exposure) + .setUniform("gamma", gamma); } shader.use();