Adding the drawKeyLight shader

This commit is contained in:
Sam Gateau 2017-05-17 18:23:47 -07:00
parent 79f700e8ce
commit 3e7795ec11
2 changed files with 6 additions and 13 deletions

View file

@ -68,7 +68,7 @@ const gpu::PipelinePointer& DebugZoneLighting::getKeyLightPipeline() {
gpu::Shader::BindingSet slotBindings;
slotBindings.insert(gpu::Shader::Binding(std::string("deferredFrameTransformBuffer"), ZONE_DEFERRED_TRANSFORM_BUFFER));
slotBindings.insert(gpu::Shader::Binding(std::string("keylightBuffer"), ZONE_KEYLIGHT_BUFFER));
slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), ZONE_KEYLIGHT_BUFFER));
gpu::Shader::makeProgram(*program, slotBindings);

View file

@ -45,22 +45,15 @@ void main(void) {
vec3 fragNormal = vec3(getViewInverse() * vec4(spherePos, 0.0));
LightAmbient lightAmbient = getLightAmbient();
Light light = getLight();
vec3 lightDirection = getLightDirection(light);
vec3 lightIrradiance = getLightIrradiance(light);
float roughness = 0.1;
float levels = getLightAmbientMapNumMips(lightAmbient);
float lod = min(((roughness)* levels), levels);
vec3 ambientMap = evalSkyboxLight(fragNormal, lod).xyz;
vec3 ambientSH = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(lightAmbient), fragNormal).xyz;
// vec3 ambient = sphericalHarmonics_evalSphericalLight(getLightAmbientSphere(lightAmbient), fragNormal).xyz;
// _fragColor = vec4( 0.5 * (fragNormal + vec3(1.0)), 1.0);
vec3 ambient = (sphereUV.x > 0 ? ambientMap : ambientSH);
vec3 color = lightIrradiance;
const float INV_GAMMA_22 = 1.0 / 2.2;
_fragColor = vec4(pow(ambient, vec3(INV_GAMMA_22)), 1.0);
_fragColor = vec4(pow(color, vec3(INV_GAMMA_22)), 1.0);
}