From 7359e95d4c2bae49ce3d6d42bd9bdedbfb25c978 Mon Sep 17 00:00:00 2001 From: Fabian Klemp Date: Mon, 9 Mar 2015 16:41:12 +0100 Subject: [PATCH 1/2] Corrected bias calculation for point light shadows. --- data/shader/phong.fsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/shader/phong.fsh b/data/shader/phong.fsh index 7562e38..fe25761 100644 --- a/data/shader/phong.fsh +++ b/data/shader/phong.fsh @@ -132,8 +132,8 @@ float samplePointShadow(samplerCubeShadow shadowMap, vec3 lightDirection) { float A = -(farPlane+nearPlane)/(farPlane-nearPlane); float B = -2*(farPlane*nearPlane)/(farPlane - nearPlane); float compValue = 0.5*(-A*length(lightDirection) + B)/length(lightDirection) + 0.5; - float bias = 0.001*tan(acos(clamp(dot(vNormal, -directionalLightVector), 0.0, 1.0))); - bias = clamp(bias, 0.0, 0.01); + float bias = 0.001*tan(acos(clamp(dot(vNormal, lightDirection), 0.0, 1.0))); + bias = clamp(bias, 0.0, 0.001); return texture(shadowMap, vec4(lightDirection , compValue - bias)); } From b4f20affebe397186219b411f79795f8d426a6ab Mon Sep 17 00:00:00 2001 From: Fabian Klemp Date: Mon, 9 Mar 2015 16:53:26 +0100 Subject: [PATCH 2/2] Changed green flame parameters. They don't clip anymore. --- data/levels/scripts/openSecondDoor1.lua | 2 +- data/levels/scripts/openSecondDoor2.lua | 2 +- data/levels/scripts/openSecondDoor3.lua | 2 +- data/levels/scripts/openSecondDoor4.lua | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/levels/scripts/openSecondDoor1.lua b/data/levels/scripts/openSecondDoor1.lua index 85f1958..e7bd2d3 100644 --- a/data/levels/scripts/openSecondDoor1.lua +++ b/data/levels/scripts/openSecondDoor1.lua @@ -29,7 +29,7 @@ function trigger(objectToChange) local yPos = 25.0 local zPos = 54.5 level:preloadLightPosition(xPos, yPos, zPos) - level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.5, 1.3, 2.3) + level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.0, 1.3, 2.0) print("openSecondDoor1") end end diff --git a/data/levels/scripts/openSecondDoor2.lua b/data/levels/scripts/openSecondDoor2.lua index b680df7..c7c0407 100644 --- a/data/levels/scripts/openSecondDoor2.lua +++ b/data/levels/scripts/openSecondDoor2.lua @@ -29,7 +29,7 @@ function trigger(objectToChange) local yPos = 25.0 local zPos = 26.5 level:preloadLightPosition(xPos, yPos, zPos) - level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.5, 1.3, 2.3) + level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.0, 1.3, 2.0) print("openSecondDoor2") end end diff --git a/data/levels/scripts/openSecondDoor3.lua b/data/levels/scripts/openSecondDoor3.lua index 9a5faf5..845d578 100644 --- a/data/levels/scripts/openSecondDoor3.lua +++ b/data/levels/scripts/openSecondDoor3.lua @@ -29,7 +29,7 @@ function trigger(objectToChange) local yPos = 25.0 local zPos = 26.5 level:preloadLightPosition(xPos, yPos, zPos) - level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.5, 1.3, 2.3) + level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.0, 1.3, 2.0) print("openSecondDoor3") end end diff --git a/data/levels/scripts/openSecondDoor4.lua b/data/levels/scripts/openSecondDoor4.lua index fe9ed6c..1b6c287 100644 --- a/data/levels/scripts/openSecondDoor4.lua +++ b/data/levels/scripts/openSecondDoor4.lua @@ -38,7 +38,7 @@ function trigger(objectToChange) local yPos = 25.0 local zPos = 54.5 level:preloadLightPosition(xPos, yPos, zPos) - level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.5, 1.3, 2.3) + level:addLightByParameters(0.2, 0.9, 0.0, 4.0, -2.0, 1.3, 2.0) print("openSecondDoor4") end end