diff --git a/libraries/render-utils/src/AmbientOcclusionEffect.cpp b/libraries/render-utils/src/AmbientOcclusionEffect.cpp index 8c14b0b0ef..5e7c584e33 100644 --- a/libraries/render-utils/src/AmbientOcclusionEffect.cpp +++ b/libraries/render-utils/src/AmbientOcclusionEffect.cpp @@ -380,16 +380,17 @@ void AmbientOcclusionEffect::updateParameters(const graphics::AmbientOcclusionPo current.w = ambientOcclusion->getAOObscuranceLevel(); } - if (shouldUpdateTechnique || ambientOcclusion->getAOFalloffAngle() != _aoParametersBuffer->getFalloffAngle()) { + const float falloffAngle = std::min(1.0f - EPSILON, ambientOcclusion->getAOFalloffAngle()); + if (shouldUpdateTechnique || falloffAngle != _aoParametersBuffer->getFalloffAngle()) { auto& current = _aoParametersBuffer.edit()._falloffInfo; - current.x = ambientOcclusion->getAOFalloffAngle(); + current.x = falloffAngle; current.y = 1.0f / (1.0f - current.x); // Compute sin from cos - current.z = sqrtf(1.0f - ambientOcclusion->getAOFalloffAngle() * ambientOcclusion->getAOFalloffAngle()); + current.z = sqrtf(1.0f - current.x * current.x); current.w = 1.0f / current.z; } - const int numSamples = ambientOcclusion->getAOSamplingAmount() * MAX_SSAO_SAMPLES; + const int numSamples = std::max(1, (int)(ambientOcclusion->getAOSamplingAmount() * MAX_HBAO_SAMPLES)); if (shouldUpdateTechnique || numSamples != _aoParametersBuffer->getNumSamples()) { auto& current = _aoParametersBuffer.edit()._sampleInfo; current.x = numSamples; @@ -423,7 +424,7 @@ void AmbientOcclusionEffect::updateParameters(const graphics::AmbientOcclusionPo current.z = ambientOcclusion->getSSAONumSpiralTurns(); } - const int numSamples = ambientOcclusion->getAOSamplingAmount() * MAX_HBAO_SAMPLES; + const int numSamples = std::max(1, (int)(ambientOcclusion->getAOSamplingAmount() * MAX_SSAO_SAMPLES)); if (shouldUpdateTechnique || numSamples != _aoParametersBuffer->getNumSamples()) { auto& current = _aoParametersBuffer.edit()._sampleInfo; current.x = numSamples; diff --git a/libraries/render-utils/src/AmbientOcclusionStage.cpp b/libraries/render-utils/src/AmbientOcclusionStage.cpp index 4adb06bbee..6b3763a39c 100644 --- a/libraries/render-utils/src/AmbientOcclusionStage.cpp +++ b/libraries/render-utils/src/AmbientOcclusionStage.cpp @@ -11,7 +11,7 @@ #include -std::string AmbientOcclusionStage::_stageName { "BLOOM_STAGE"}; +std::string AmbientOcclusionStage::_stageName { "AMBIENT_OCCLUSION_STAGE" }; const AmbientOcclusionStage::Index AmbientOcclusionStage::INVALID_INDEX { render::indexed_container::INVALID_INDEX }; AmbientOcclusionStage::Index AmbientOcclusionStage::findAmbientOcclusion(const AmbientOcclusionPointer& ambientOcclusion) const { diff --git a/libraries/render-utils/src/BackgroundStage.cpp b/libraries/render-utils/src/BackgroundStage.cpp index 91b766d90b..455f356a45 100644 --- a/libraries/render-utils/src/BackgroundStage.cpp +++ b/libraries/render-utils/src/BackgroundStage.cpp @@ -15,7 +15,7 @@ #include -std::string BackgroundStage::_stageName { "BACKGROUND_STAGE"}; +std::string BackgroundStage::_stageName { "BACKGROUND_STAGE" }; const BackgroundStage::Index BackgroundStage::INVALID_INDEX { render::indexed_container::INVALID_INDEX }; BackgroundStage::Index BackgroundStage::findBackground(const BackgroundPointer& background) const { diff --git a/libraries/render-utils/src/BloomStage.cpp b/libraries/render-utils/src/BloomStage.cpp index b3ba5f9565..2bedfeea96 100644 --- a/libraries/render-utils/src/BloomStage.cpp +++ b/libraries/render-utils/src/BloomStage.cpp @@ -13,7 +13,7 @@ #include -std::string BloomStage::_stageName { "BLOOM_STAGE"}; +std::string BloomStage::_stageName { "BLOOM_STAGE" }; const BloomStage::Index BloomStage::INVALID_INDEX { render::indexed_container::INVALID_INDEX }; BloomStage::Index BloomStage::findBloom(const BloomPointer& bloom) const { diff --git a/libraries/render-utils/src/HazeStage.cpp b/libraries/render-utils/src/HazeStage.cpp index c850828be5..9251e1e2f9 100644 --- a/libraries/render-utils/src/HazeStage.cpp +++ b/libraries/render-utils/src/HazeStage.cpp @@ -13,7 +13,7 @@ #include -std::string HazeStage::_stageName { "HAZE_STAGE"}; +std::string HazeStage::_stageName { "HAZE_STAGE" }; const HazeStage::Index HazeStage::INVALID_INDEX { render::indexed_container::INVALID_INDEX }; HazeStage::Index HazeStage::findHaze(const HazePointer& haze) const { diff --git a/libraries/render-utils/src/LightStage.cpp b/libraries/render-utils/src/LightStage.cpp index ccdf45cedc..58f32cdc4e 100644 --- a/libraries/render-utils/src/LightStage.cpp +++ b/libraries/render-utils/src/LightStage.cpp @@ -15,7 +15,7 @@ #include "ViewFrustum.h" -std::string LightStage::_stageName { "LIGHT_STAGE"}; +std::string LightStage::_stageName { "LIGHT_STAGE" }; // The bias matrix goes from homogeneous coordinates to UV coords (see http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/#basic-shader) const glm::mat4 LightStage::Shadow::_biasMatrix { 0.5, 0.0, 0.0, 0.0, diff --git a/libraries/render-utils/src/TonemappingStage.cpp b/libraries/render-utils/src/TonemappingStage.cpp index dcfe3c28c4..9b6029ca1b 100644 --- a/libraries/render-utils/src/TonemappingStage.cpp +++ b/libraries/render-utils/src/TonemappingStage.cpp @@ -11,7 +11,7 @@ #include -std::string TonemappingStage::_stageName { "TONEMAPPING_STAGE"}; +std::string TonemappingStage::_stageName { "TONEMAPPING_STAGE" }; const TonemappingStage::Index TonemappingStage::INVALID_INDEX { render::indexed_container::INVALID_INDEX }; TonemappingStage::Index TonemappingStage::findTonemapping(const TonemappingPointer& tonemapping) const { diff --git a/libraries/render-utils/src/ZoneRenderer.cpp b/libraries/render-utils/src/ZoneRenderer.cpp index 866b3c407c..d9c0de9934 100644 --- a/libraries/render-utils/src/ZoneRenderer.cpp +++ b/libraries/render-utils/src/ZoneRenderer.cpp @@ -90,7 +90,7 @@ void SetupZones::run(const RenderContextPointer& context, const Input& input) { hazeStage->_currentFrame.pushHaze(0); bloomStage->_currentFrame.pushBloom(INVALID_INDEX); tonemappingStage->_currentFrame.pushTonemapping(0); - ambientOcclusionStage->_currentFrame.pushAmbientOcclusion(0); + ambientOcclusionStage->_currentFrame.pushAmbientOcclusion(INVALID_INDEX); } const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {