diff --git a/libraries/render-utils/src/AmbientOcclusionEffect.cpp b/libraries/render-utils/src/AmbientOcclusionEffect.cpp index 596848cedd..30360fdbce 100644 --- a/libraries/render-utils/src/AmbientOcclusionEffect.cpp +++ b/libraries/render-utils/src/AmbientOcclusionEffect.cpp @@ -115,7 +115,7 @@ const gpu::PipelinePointer& AmbientOcclusionEffect::getPyramidPipeline() { gpu::StatePointer state = gpu::StatePointer(new gpu::State()); - // Stencil test all the ao passes for objects pixels only, not the background + // Stencil test the pyramid passe for objects pixels only, not the background state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP)); state->setColorWriteMask(true, false, false, false); @@ -140,9 +140,6 @@ const gpu::PipelinePointer& AmbientOcclusionEffect::getOcclusionPipeline() { gpu::StatePointer state = gpu::StatePointer(new gpu::State()); - // Stencil test the ao passes for objects pixels only, not the background - state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP)); - state->setColorWriteMask(true, true, true, false); // Good to go add the brand new pipeline @@ -165,10 +162,7 @@ const gpu::PipelinePointer& AmbientOcclusionEffect::getHBlurPipeline() { gpu::Shader::makeProgram(*program, slotBindings); gpu::StatePointer state = gpu::StatePointer(new gpu::State()); - - // Stencil test all the ao passes for objects pixels only, not the background - //state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP)); - + state->setColorWriteMask(true, true, true, false); // Good to go add the brand new pipeline @@ -192,9 +186,6 @@ const gpu::PipelinePointer& AmbientOcclusionEffect::getVBlurPipeline() { gpu::StatePointer state = gpu::StatePointer(new gpu::State()); - // Stencil test all the ao passes for objects pixels only, not the background - //state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP)); - // Vertical blur write just the final result Occlusion value in the alpha channel state->setColorWriteMask(true, true, true, false); diff --git a/libraries/render-utils/src/FramebufferCache.cpp b/libraries/render-utils/src/FramebufferCache.cpp index fe7e9f9993..7948dfcefe 100644 --- a/libraries/render-utils/src/FramebufferCache.cpp +++ b/libraries/render-utils/src/FramebufferCache.cpp @@ -247,7 +247,8 @@ gpu::TexturePointer FramebufferCache::getDepthPyramidTexture() { } void FramebufferCache::setAmbientOcclusionResolutionLevel(int level) { - level = std::max(0, std::min(level, 4)); + const int MAX_AO_RESOLUTION_LEVEL = 4; + level = std::max(0, std::min(level, MAX_AO_RESOLUTION_LEVEL)); if (level != _AOResolutionLevel) { _AOResolutionLevel = level; resizeAmbientOcclusionBuffers(); diff --git a/libraries/render-utils/src/ssao_makeOcclusion.slf b/libraries/render-utils/src/ssao_makeOcclusion.slf index 4c08da19bd..72424cad1e 100644 --- a/libraries/render-utils/src/ssao_makeOcclusion.slf +++ b/libraries/render-utils/src/ssao_makeOcclusion.slf @@ -133,6 +133,7 @@ void main(void) { float A = max(0.0, 1.0 - sum * getObscuranceScaling() * 5.0 * getInvNumSamples()); + outFragColor = vec4(packOcclusionDepth(A, CSZToDephtKey(Cp.z)), 1.0);