Early try fixing the lighting

This commit is contained in:
samcake 2015-12-03 10:41:32 -08:00
parent 5d7f624285
commit a5475ed14d
2 changed files with 34 additions and 2 deletions

View file

@ -33,7 +33,7 @@ vec4 evalPBRShading(vec3 fragNormal, vec3 fragLightDir, vec3 fragEyeDir, vec3 sp
vec3 schlick = specular * (1.0 - shlickPower5) + vec3(shlickPower5);
vec3 reflect = specularPower * schlick;
return vec4(reflect, diffuse);
return vec4(reflect, diffuse * (1 - length(schlick)));
}
<@endfunc@>

View file

@ -143,7 +143,39 @@ void DeferredLightingEffect::init(AbstractViewStateInterface* viewState) {
{
//auto VSFS = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS();
//auto PSBlit = gpu::StandardShaderLib::getDrawTexturePS();
auto blitProgram = gpu::StandardShaderLib::getProgram(gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS, gpu::StandardShaderLib::getDrawTexturePS);
const char BlitTextureGamma_frag[] = R"SCRIBE(#version 410 core
// Generated on Sat Oct 24 09:34:37 2015
//
// Draw texture 0 fetched at texcoord.xy
//
// Created by Sam Gateau on 6/22/2015
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
uniform sampler2D colorMap;
in vec2 varTexCoord0;
out vec4 outFragColor;
void main(void) {
outFragColor = texture(colorMap, varTexCoord0);
if (gl_FragCoord.x > 1000) {
outFragColor.xyz = pow( outFragColor.xyz , vec3(1.0/2.2) );
}
}
)SCRIBE";
auto blitPS = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(BlitTextureGamma_frag)));
//auto blitProgram = gpu::StandardShaderLib::getProgram(gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS, gpu::StandardShaderLib::getDrawTexturePS);
auto blitVS = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS();
auto blitProgram = gpu::ShaderPointer(gpu::Shader::createProgram(blitVS, blitPS));
//auto blitProgram = gpu::StandardShaderLib::getProgram(gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS, gpu::StandardShaderLib::getDrawTexturePS);
gpu::Shader::makeProgram(*blitProgram);
auto blitState = std::make_shared<gpu::State>();
blitState->setBlendFunction(true,