Added SSAOPower variable and exposed to GUI
parent
894377d440
commit
24516b592e
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -90,6 +90,7 @@ struct Renderer {
|
|||
|
||||
float mSSAORadius = 0.5f;
|
||||
float mSSAOBias = 0.025f;
|
||||
float mSSAOPower = 1.0f;
|
||||
int mSSAOKernelSize = 64;
|
||||
std::vector<Vector3f> mSSAOKernel;
|
||||
GLuint mSSAONoiseTexture = -1;
|
||||
|
|
Loading…
Reference in New Issue