From 0492bb1c6dd5473d309121d8467d4159f52ee133 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 18 Dec 2015 13:50:28 -0800 Subject: [PATCH] Final cleans and tests using R11G11B10 for lighting buffer --- libraries/render-utils/src/FramebufferCache.cpp | 5 +++-- libraries/render-utils/src/ToneMappingEffect.cpp | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/libraries/render-utils/src/FramebufferCache.cpp b/libraries/render-utils/src/FramebufferCache.cpp index e64e245806..9f3d4ba0fe 100644 --- a/libraries/render-utils/src/FramebufferCache.cpp +++ b/libraries/render-utils/src/FramebufferCache.cpp @@ -89,9 +89,10 @@ void FramebufferCache::createPrimaryFramebuffer() { auto smoothSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR); + // FIXME: Decide on the proper one, let s stick to R11G11B10 for now //_lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element::COLOR_RGBA_32, width, height, defaultSampler)); - //lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::R11G11B10), width, height, defaultSampler)); - _lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::HALF, gpu::RGBA), width, height, smoothSampler)); + _lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC3, gpu::NUINT8, gpu::R11G11B10), width, height, defaultSampler)); + //_lightingTexture = gpu::TexturePointer(gpu::Texture::create2D(gpu::Element(gpu::VEC4, gpu::HALF, gpu::RGBA), width, height, defaultSampler)); _lightingFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create()); _lightingFramebuffer->setRenderBuffer(0, _lightingTexture); _lightingFramebuffer->setDepthStencilBuffer(_primaryDepthTexture, depthFormat); diff --git a/libraries/render-utils/src/ToneMappingEffect.cpp b/libraries/render-utils/src/ToneMappingEffect.cpp index 29e5da6e2a..a00a66fe69 100644 --- a/libraries/render-utils/src/ToneMappingEffect.cpp +++ b/libraries/render-utils/src/ToneMappingEffect.cpp @@ -64,13 +64,9 @@ void ToneMappingEffect::init() { out vec4 outFragColor; void main(void) { - vec4 fragColorRaw = textureLod(colorMap, varTexCoord0, 0); + vec4 fragColorRaw = texture(colorMap, varTexCoord0); vec3 fragColor = fragColorRaw.xyz; -/* - vec4 fragColorAverage = textureLod(colorMap, varTexCoord0, 10); - float averageIntensity = length(fragColorAverage.xyz); - fragColor /= averageIntensity; -*/ + vec3 srcColor = fragColor * getTwoPowExposure(); int toneCurve = getToneCurve(); @@ -124,7 +120,8 @@ void ToneMappingEffect::render(RenderArgs* args) { auto destFbo = framebufferCache->getPrimaryFramebuffer(); batch.setFramebuffer(destFbo); - batch.generateTextureMips(lightingBuffer); + // FIXME: Generate the Luminosity map + //batch.generateTextureMips(lightingBuffer); batch.setViewportTransform(args->_viewport); batch.setProjectionTransform(glm::mat4());