diff --git a/data/shaders/fs_ssao.glsl b/data/shaders/fs_ssao.glsl index ef16ccf..7a6312d 100644 --- a/data/shaders/fs_ssao.glsl +++ b/data/shaders/fs_ssao.glsl @@ -10,6 +10,7 @@ uniform sampler2D uNoise; uniform float uRadius; uniform float uBias; +uniform float uPower; uniform int uSampleCount; uniform vec3 uSamples[64]; uniform mat4 uProjection; @@ -40,6 +41,6 @@ void main() { occlusion += (sample_depth >= sample.z + uBias ? 1.0 : 0.0) * range_check; } - occlusion = 1.0 - (occlusion / uSampleCount); + occlusion = pow(1.0 - (occlusion / uSampleCount), uPower); outColor = vec3(occlusion); } diff --git a/src/modules/RenderModule.cc b/src/modules/RenderModule.cc index f4fecb1..869277c 100644 --- a/src/modules/RenderModule.cc +++ b/src/modules/RenderModule.cc @@ -631,6 +631,7 @@ void Renderer::RenderGl() { mSSAOProgram.SetFloat("uRadius", mSSAORadius); mSSAOProgram.SetFloat("uBias", mSSAOBias); + mSSAOProgram.SetFloat("uPower", mSSAOPower); mSSAOProgram.SetInt("uSampleCount", mSSAOKernel.size()); mSSAOProgram.SetMat44("uProjection", mCamera.mProjectionMatrix); @@ -845,6 +846,7 @@ void Renderer::DrawGui() { if (mIsSSAOEnabled) { ImGui::SliderFloat("Radius", &mSSAORadius, 0.0f, 1.0f); ImGui::SliderFloat("Bias", &mSSAOBias, 0.0f, 0.1f); + ImGui::SliderFloat("Power", &mSSAOPower, 1.0f, 10.0f); ImGui::SliderInt("Samples", &mSSAOKernelSize, 1, 64); ImGui::SliderInt("Blur Size", &mSSAOBlurSize, 0, 8); ImGui::Checkbox("Disable Color", &mSSAODisableColor); diff --git a/src/modules/RenderModule.h b/src/modules/RenderModule.h index 3aca00b..6229f9c 100644 --- a/src/modules/RenderModule.h +++ b/src/modules/RenderModule.h @@ -90,6 +90,7 @@ struct Renderer { float mSSAORadius = 0.5f; float mSSAOBias = 0.025f; + float mSSAOPower = 1.0f; int mSSAOKernelSize = 64; std::vector mSSAOKernel; GLuint mSSAONoiseTexture = -1;