History

Fixing the way the Obscurance is used with the ssao map

samcake committed 10 years ago

Commit 287bfed1 parent ae6e6252 files · +11 −3Browse files

Showing the changes to libraries/render-utils/src/DebugDeferredBuffer.cpp (1 of 2 files). Show all

Unified · Split

libraries/render-utils/src/DebugDeferredBuffer.cpp+10−3
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020
2121 #include "GeometryCache.h"
2222 #include "FramebufferCache.h"
23+#include "TextureCache.h"
2324 #include "DeferredLightingEffect.h"
2425
2526 #include "debug_deferred_buffer_vert.h"
@@ -138,7 +139,7 @@ static const std::string DEFAULT_PYRAMID_DEPTH_SHADER { · 112 unmodified lines
138139
139140 static const std::string DEFAULT_AMBIENT_OCCLUSION_SHADER{
140141 "vec4 getFragmentColor() {"
141− " return vec4(vec3(texture(occlusionMap, uv).x), 1.0);"
142+ " return vec4(vec3(texture(obscuranceMap, uv).x), 1.0);"
142143 // When drawing color " return vec4(vec3(texture(occlusionMap, uv).xyz), 1.0);"
143144 // when drawing normal " return vec4(normalize(texture(occlusionMap, uv).xyz * 2.0 - vec3(1.0)), 1.0);"
144145 " }"
@@ -251,10 +252,10 @@ const gpu::PipelinePointer& DebugDeferredBuffer::getPipeline(Mode mode, std::str · 106 unmodified lines
251252 slotBindings.insert(gpu::Shader::Binding("normalMap", Normal));
252253 slotBindings.insert(gpu::Shader::Binding("specularMap", Specular));
253254 slotBindings.insert(gpu::Shader::Binding("depthMap", Depth));
255+ slotBindings.insert(gpu::Shader::Binding("obscuranceMap", AmbientOcclusion));
254256 slotBindings.insert(gpu::Shader::Binding("lightingMap", Lighting));
255257 slotBindings.insert(gpu::Shader::Binding("shadowMap", Shadow));
256258 slotBindings.insert(gpu::Shader::Binding("pyramidMap", Pyramid));
257− slotBindings.insert(gpu::Shader::Binding("occlusionMap", AmbientOcclusion));
258259 slotBindings.insert(gpu::Shader::Binding("occlusionBlurredMap", AmbientOcclusionBlurred));
259260 gpu::Shader::makeProgram(*program, slotBindings);
260261
@@ -288,6 +289,7 @@ void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const Ren · 27 unmodified lines
288289 gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
289290 const auto geometryBuffer = DependencyManager::get<GeometryCache>();
290291 const auto framebufferCache = DependencyManager::get<FramebufferCache>();
292+ const auto textureCache = DependencyManager::get<TextureCache>();
291293 const auto& lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage();
292294
293295 glm::mat4 projMat;
@@ -310,7 +312,12 @@ void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const Ren · 16 unmodified lines
310312 batch.setResourceTexture(Lighting, framebufferCache->getLightingTexture());
311313 batch.setResourceTexture(Shadow, lightStage.lights[0]->shadow.framebuffer->getDepthStencilBuffer());
312314 batch.setResourceTexture(Pyramid, framebufferCache->getDepthPyramidTexture());
313− batch.setResourceTexture(AmbientOcclusion, framebufferCache->getOcclusionTexture());
315+ if (DependencyManager::get<DeferredLightingEffect>()->isAmbientOcclusionEnabled()) {
316+ batch.setResourceTexture(AmbientOcclusion, framebufferCache->getOcclusionTexture());
317+ } else {
318+ // need to assign the white texture if ao is off
319+ batch.setResourceTexture(AmbientOcclusion, textureCache->getWhiteTexture());
320+ }
314321 batch.setResourceTexture(AmbientOcclusionBlurred, framebufferCache->getOcclusionBlurredTexture());
315322
316323 const glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f);