The shadows are working

This commit is contained in:
FakeShemp
2016-02-29 19:17:16 +01:00
parent 70374fa10e
commit 2ed5fad699
4 changed files with 15 additions and 24 deletions
+4 -3
View File
@@ -2,6 +2,7 @@
#define MAX_SPLITS 4
#define MIN_AMBIENT_LIGHT 0.3
#define SHADOW_STRENGTH 0.3 //Should be ambient
uniform mat4 M;
uniform mat4 V;
@@ -235,7 +236,7 @@ float CalcShadowValue(vec4 light_space_pos, vec3 normal, vec3 light_dir, sampler
//shadowMapDepth = PoissonDotShadow(depth_texture_array, projCoords, layer_index, 4, 25.0 * FarDistance[MAX_SPLITS - 1]);
shadowMapDepth = SoftwarePCF(depth_texture_array, projCoords, layer_index, bias);
return 1.0 - shadowMapDepth;
return shadowMapDepth;
}
int getShadowIndex(float far_distance[1])
@@ -342,8 +343,8 @@ void main()
totalLighting.Specular += vec4(light_result.Specular.rgb * ao, light_result.Specular.a);
}
totalLighting.Diffuse *= (1.5 + vec4(AmbientColor.rgba)) - vec4(vec3(shadowFactor), 0.0);
totalLighting.Specular *= (1.5 + vec4(AmbientColor.rgba)) - vec4(vec3(shadowFactor), 0.0);
totalLighting.Diffuse *= vec4(min(vec3(shadowFactor) + AmbientColor.xyz, vec3(1.0)), 1.0);
totalLighting.Specular *= vec4(min(vec3(shadowFactor) + AmbientColor.xyz, vec3(1.0)), 1.0);
//LightResult getInformation;
-8
View File
@@ -25,14 +25,6 @@ out VertexData{
vec4 PositionLightSpace[MAX_SPLITS];
}Output;
// N
mat4 biasMatrix = mat4(
vec4(0.5, 0.0, 0.0, 0.0),
vec4(0.0, 0.5, 0.0, 0.0),
vec4(0.0, 0.0, 0.5, 0.0),
vec4(0.5, 0.5, 0.5, 1.0)
);
void main()
{
gl_Position = P*V*M * vec4(Position, 1.0);