Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2876)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg	(revision 2882)
@@ -27,5 +27,5 @@
 
 	// global ambient
-	const float4 ambient = 0.3f;
+	const float4 ambient = 0.25f;
 
 	// float3 L = normalize(lightPosition - position);
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/shadow.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/shadow.cg	(revision 2882)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/shadow.cg	(revision 2882)
@@ -0,0 +1,56 @@
+//----------------------------------------------------------------------------------
+// File:   shadow_single_fragment.glsl
+// Author: Rouslan Dimitrov
+// Email:  sdkfeedback@nvidia.com
+// Cascaded shadows maps, single shadow sample
+// Copyright (c) NVIDIA Corporation. All rights reserved.
+//----------------------------------------------------------------------------------
+#version 120
+#extension GL_EXT_texture_array : enable
+
+uniform sampler2D tex;
+uniform vec4 far_d;
+
+varying vec4 vPos;
+
+uniform sampler2DArray stex;
+float shadowCoef()
+{
+	int index = 3;
+	
+	// find the appropriate depth map to look up in based on the depth of this fragment
+	if(gl_FragCoord.z < far_d.x)
+		index = 0;
+	else if(gl_FragCoord.z < far_d.y)
+		index = 1;
+	else if(gl_FragCoord.z < far_d.z)
+		index = 2;
+	
+	// transform this fragment's position from view space to scaled light clip space
+	// such that the xy coordinates are in [0;1]
+	// note there is no need to divide by w for othogonal light sources
+	vec4 shadow_coord = gl_TextureMatrix[index]*vPos;
+
+	shadow_coord.w = shadow_coord.z;
+	
+	// tell glsl in which layer to do the look up
+	shadow_coord.z = float(index);
+	
+	// get the stored depth
+	float shadow_d = texture2DArray(stex, shadow_coord.xyz).x;
+	
+	// get the difference of the stored depth and the distance of this fragment to the light
+	float diff = shadow_d - shadow_coord.w;
+	
+	// smoothen the result a bit, to avoid aliasing at shadow contact point
+	return clamp( diff*250.0 + 1.0, 0.0, 1.0);
+}
+
+void main()
+{
+    const float shadow_ambient = 0.9;
+	vec4 color_tex = texture2D(tex, gl_TexCoord[0].st);
+	float shadow_coef = shadowCoef();
+	float fog = clamp(gl_Fog.scale*(gl_Fog.end + vPos.z), 0.0, 1.0);
+	gl_FragColor = mix(gl_Fog.color, (shadow_ambient * shadow_coef * gl_Color * color_tex + (1.0 - shadow_ambient) * color_tex), fog);
+}
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2881)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg	(revision 2882)
@@ -8,5 +8,5 @@
 // rule of thumb: approx 1 / NUM_SAMPLES
 //#define SAMPLE_INTENSITY 0.15f
-#define SAMPLE_INTENSITY 0.2f
+#define SAMPLE_INTENSITY 0.22f
 
 #define AREA_SIZE 7e-1f
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg	(revision 2881)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg	(revision 2882)
@@ -8,5 +8,5 @@
 // rule of thumb: approx 1 / NUM_SAMPLES
 //#define SAMPLE_INTENSITY 0.15f
-#define SAMPLE_INTENSITY 0.2f
+#define SAMPLE_INTENSITY 0.22f
 
 #define AREA_SIZE 7e-1f
@@ -16,5 +16,5 @@
 #define DISTANCE_SCALE 1e-6f
 
-#define ILLUM_SCALE 5e-1f;
+#define ILLUM_INTENSITY 5e-1f;
 
 
@@ -112,5 +112,5 @@
 		total_color.w -= cos_angle * distance_intensity * view_correction;
 
-		total_color.xyz += cos_angle * distance_intensity * view_correction * sample_color * ILLUM_SCALE;
+		total_color.xyz += cos_angle * distance_intensity * view_correction * sample_color * ILLUM_INTENSITY;
 	}
 
Index: GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
===================================================================
--- GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2879)
+++ GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 2882)
@@ -800,4 +800,8 @@
 			</File>
 			<File
+				RelativePath=".\src\shaders\shadow.cg"
+				>
+			</File>
+			<File
 				RelativePath=".\src\shaders\ssao.cg"
 				>
