and fixing a bug with shadowing of lightmapped surface

This commit is contained in:
Sam Gateau 2015-02-26 18:07:43 -08:00
parent 74f0d98fd6
commit c7eeebe52c
2 changed files with 4 additions and 2 deletions

View file

@ -18,7 +18,7 @@ var stageOrientation = Quat.fromPitchYawRollDegrees(0.0, 180.0, 0.0);
Scene.setStageDayTime(hour);
Scene.setStageOrientation(stageOrientation);
Scene.setStageLocation(longitude, latitude, 0.0);
/*
function ticktack() {
hour += 0.1;
//Scene.setSunIntensity(Math.cos(time));
@ -31,3 +31,4 @@ function ticktack() {
}
Script.setInterval(ticktack, 41);
*/

View file

@ -95,7 +95,8 @@ vec3 evalAmbienSphereGlobalColor(float shadowAttenuation, vec3 position, vec3 no
vec3 evalLightmappedColor(float shadowAttenuation, vec3 normal, vec3 diffuse, vec3 lightmap) {
Light light = getLight();
float diffuseDot = dot(normal, getLightDirection(light));
vec3 fragNormal = vec3(invViewMat * vec4(normal, 0.0));
float diffuseDot = dot(fragNormal, -getLightDirection(light));
// need to catch normals perpendicular to the projection plane hence the magic number for the threshold
// it should be just 0, but we have innacurracy so we need to overshoot