Disabled directional light if its below the map.

This commit is contained in:
Faerbit 2015-03-08 14:56:18 +01:00
parent b8538be749
commit abca7c9f1e

View File

@ -114,6 +114,7 @@ void main()
// direction lighting // direction lighting
if(length(directionalLightVector)>0.0f) { if(length(directionalLightVector)>0.0f) {
vec3 directionalVector = normalize(directionalLightVector); vec3 directionalVector = normalize(directionalLightVector);
if (dot(vec3(0.0, 1.0, 0.0), directionalVector) > 0.0) {
float directionalVisibility = 1.0f; float directionalVisibility = 1.0f;
if (distanceToBorder(shadowCoord1.xy) <= 0.5 && distanceToBorder(shadowCoord1.xy) > 0.2) { if (distanceToBorder(shadowCoord1.xy) <= 0.5 && distanceToBorder(shadowCoord1.xy) > 0.2) {
if (distanceToBorder(shadowCoord0.xy) <= 0.5 && distanceToBorder(shadowCoord0.xy) > 0.2) { if (distanceToBorder(shadowCoord0.xy) <= 0.5 && distanceToBorder(shadowCoord0.xy) > 0.2) {
@ -143,6 +144,7 @@ void main()
(length(cameraVector+directionalVector)*length(normalize(vNormal)))),shininess), 0.0, 1.0) (length(cameraVector+directionalVector)*length(normalize(vNormal)))),shininess), 0.0, 1.0)
*specularFactor*directionalIntensity*directionalColor*directionalVisibility; *specularFactor*directionalIntensity*directionalColor*directionalVisibility;
} }
}
// point lights // point lights
float visibility = 1.0; float visibility = 1.0;