Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.material	(revision 1118)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.material	(revision 1131)
@@ -148,7 +148,7 @@
 	 vertex_program_ref GameTools/FocusingVS
          {       
-            param_named_auto worldView worldview_matrix
-            param_named_auto worldViewProj worldviewproj_matrix
-	    param_named lightTransform matrix4x4	 
+			param_named_auto world		world_matrix
+            param_named_auto worldViewProj worldviewproj_matrix
+			param_named lightTransform matrix4x4	 
          } 
 	 fragment_program_ref  GameTools/FocusingPS
@@ -171,9 +171,9 @@
       { 
 		//cull_hardware anticlockwise
+		//cull_hardware none
 		
 		vertex_program_ref GameTools/ShadowMap/DepthVS
         {       
-           param_named_auto viewProj viewproj_matrix
-           param_named_auto worldViewProj worldviewproj_matrix            
+          param_named_auto worldViewProj worldviewproj_matrix            
 	    } 
 		fragment_program_ref  GameTools/ShadowMap/DepthPS
@@ -185,2 +185,29 @@
     }
 }
+
+
+material GameTools/Blur
+{ 
+
+   technique 
+   { 
+      
+      pass 
+      { 		
+		vertex_program_ref GameTools/BlurVS
+        {       
+                     
+	    } 
+		fragment_program_ref  GameTools/BlurPS
+        { 
+			param_named_auto width viewport_width
+			param_named_auto height viewport_height
+        }
+        texture_unit
+        {
+			filtering bilinear
+        }
+        
+       }
+    }
+}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.program
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.program	(revision 1118)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.program	(revision 1131)
@@ -1,2 +1,16 @@
+vertex_program GameTools/BlurVS hlsl
+{
+	source GameTools_Blur.hlsl
+	entry_point BlurVS
+	target vs_2_0
+} 
+
+fragment_program GameTools/BlurPS hlsl
+{
+	source GameTools_Blur.hlsl
+	entry_point BlurPS
+	target ps_3_0
+} 
+
 vertex_program GameTools/FocusingVS hlsl
 {
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl	(revision 1126)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl	(revision 1131)
@@ -7,7 +7,5 @@
 
 VS_OUT DepthVS(float4 position : POSITION,	
-				uniform float4x4 worldViewProj,				
-				uniform float4x4 viewProj,
-				uniform float4x4 cameraMatrix)
+				uniform float4x4 worldViewProj)
 {
   
@@ -15,5 +13,5 @@
  
   OUT.hPosition = mul(worldViewProj, position);
-  OUT.Position = mul(viewProj, position);
+  OUT.Position = mul(worldViewProj, position);
   
   return OUT;
@@ -25,5 +23,5 @@
 	float4 pos = (IN.Position / IN.Position.w);
 	pos = (pos +1.0 ) / 2.0;
-	return pos.z;	
+	return float4(pos.z, pos.z * pos.z, 1, 1);	
 }
 
@@ -39,9 +37,11 @@
 VS_OUT_SHADOW depthShadowVS(float4 position : POSITION,	
 							uniform float4x4 worldViewProj,
+							uniform float4x4 world,
 							uniform float4x4 lightViewProj)
 {
   VS_OUT_SHADOW OUT;
   OUT.hPosition = mul(worldViewProj, position);
-  OUT.lPosition = mul(lightViewProj, position);  
+  float4 wPos = mul(world, position);
+  OUT.lPosition = mul(lightViewProj, wPos);  
   OUT.Position = position;  
   return OUT;
@@ -54,14 +54,23 @@
 					):COLOR
 {	
-	float bias = 0.01;
+	float bias = 0.1;
 	float4 light = float4(1,1,1,1);
 	float4 shadow = float4(0.3,0.3,0.3,1);
 	
 	float4 pos = (IN.lPosition / IN.lPosition.w);
-	pos = (pos +1.0 ) / 2.0;
+	pos.xy = (pos.xy +1.0 ) / 2.0;
 	pos.y = 1.0 - pos.y;
 	float4 storedDepth = tex2D(depthShadowMap, pos.xy);
-	if(storedDepth.r + bias < pos.z)
-		light = shadow;
+	
+	if(storedDepth.r + bias > pos.z)
+	{
+		float M1 = storedDepth.r;
+		float M2 = storedDepth.g;
+		float v2 = M2 - M1 * M1;
+		float pmax = v2 / (v2 + pow(M1 - pos.z, 2));
+		light = shadow + (1 - shadow) * pmax;
+		
+		//light = shadow;
+	}
 	//return abs( pos.z - storedDepth.z );	
 	return light;	
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Focusing.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Focusing.hlsl	(revision 1126)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Focusing.hlsl	(revision 1131)
@@ -6,11 +6,12 @@
 
 VS_OUT FocusingVS(float4 position : POSITION,	
-		uniform float4x4 worldView,
+		uniform float4x4 world,
 		uniform float4x4 worldViewProj,
 		uniform float4x4 lightTransform)
 {
   VS_OUT OUT;
-  OUT.hPosition = mul(worldViewProj, position);  
-  OUT.Position = mul(lightTransform, position);
+  OUT.hPosition = mul(worldViewProj, position);
+  float4 wPos = mul(world, position);  
+  OUT.Position = mul(lightTransform, wPos);
   return OUT;
 }
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/models/level.txt
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/models/level.txt	(revision 1082)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/models/level.txt	(revision 1131)
@@ -4,10 +4,10 @@
 }
 
-entity hangar
-{
-	mesh hangarmesh
-	transformation 0.5 0 0 0 0 1 0 0 0 0 0.5 0 0 0 0 1
-	pathmapfile hangarprm.hdr
-}
+//entity hangar
+//{
+//	mesh hangarmesh
+//	transformation 0.5 0 0 0 0 1 0 0 0 0 0.5 0 0 0 0 1
+//	pathmapfile hangarprm.hdr
+//}
 
 mesh stairsmesh
