Final cleans and tests using R11G11B10 for lighting buffer

This commit is contained in:
samcake 2015-12-18 13:50:28 -08:00
parent f6c80e01e9
commit 0492bb1c6d
2 changed files with 7 additions and 9 deletions

View file

@ -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);

View file

@ -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());