Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMapWeightCompute.hlsl
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMapWeightCompute.hlsl	(revision 2337)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMapWeightCompute.hlsl	(revision 2403)
@@ -57,32 +57,29 @@
 	float cosb = max(dot(dir, diff), 0);	
 	
-	float visibility = 1;
+	float visibility = 0;
 	float4 lightVPos = mul(lightViewProj, float4(pos,1));
-	
-	if( lightVPos.z > 0.0)
-	{
-		lightVPos /= lightVPos.w;
-		float d = length(lightVPos.xy);
-	
-		if(d <= 1.0)
-		{
-
-		float dist = sqrt(dist2); 
-		float distNorm = dist / lightFarPlane;
-		lightVPos.xy = (lightVPos.xy + 1.0) / 2.0;
-		lightVPos.y = 1.0 - lightVPos.y;
-		float storedDist = tex2D(shadowMap, lightVPos.xy).r;
-		dist -= DIST_BIAS;
-		visibility = (distNorm <= storedDist);  
 		
+  	//if( lightVPos.z  > 0.0)
+  	//{	
+    	lightVPos /= lightVPos.w;
+  		//float d = length(lightVPos.xy);
+   		
+  		//if(d <= 1.0)
+    	{
+			float dist = dist / lightFarPlane;
+			lightVPos.xy = (lightVPos.xy + 1.0) / 2.0;
+			lightVPos.y = 1.0 - lightVPos.y;
+			float storedDist = tex2D(shadowMap, lightVPos.xy).r;
+			visibility = dist < storedDist + DIST_BIAS;
 		}
-	}
-	
-	float spotFalloff = (dot(normalize(-diff), normalize(lightDir)) - lightAngleCos) / (1.0 - lightAngleCos);
+   // }
+    //visibility = 1.0 - visibility;
+    visibility = 1.0 + 0.00001 * visibility;
+	float spotFalloff = (dot(-diff, normalize(lightDir)) - lightAngleCos) / (1.0 - lightAngleCos);
+	//spotFalloff = saturate(dot(normalize(pos - lightPos), normalize(lightDir))) + 0.0000000001 * lightAngleCos;
+	spotFalloff = 1.0 + spotFalloff * 0.000000001;
 	spotFalloff = pow(saturate(spotFalloff), spotLightFalloff);
-
-	
-	visibility *= spotFalloff / (lightAttenuation.y + dist * lightAttenuation.z + dist * dist * lightAttenuation.w);
-
+		
+	visibility *= spotFalloff / (lightAttenuation.y + dist * lightAttenuation.z + dist2 * lightAttenuation.w);
 	
 	float4 ret = visibility * cosb * lightPower * lightColor;
@@ -114,6 +111,7 @@
 	float storedDist = texCUBE(shadowMap, float3(-diff.xy, diff.z)).r;
 	dist -= DIST_BIAS;
-	visibility = (distNorm <= storedDist);  
-			
+	visibility = (distNorm <= storedDist);
+	  
+	//visibility = 1.0 + 0.00001 * visibility;		
 	visibility *=  1.0 / (lightAttenuation.y + dist * lightAttenuation.z + dist * dist * lightAttenuation.w);
 	
@@ -143,5 +141,5 @@
 		float2 coord2 = coord1 + float2(0.25 * dataColumnWidth, 0);
 		float3 w = tex2Dlod(allWeightsSampler, float4(coord1, 0, 0)).rgb;
-		float radrad = tex2Dlod(radionSampler, float4(coord1, 0, 0)).a;		
+		float radrad = tex2Dlod(radionSampler, float4(coord2, 0, 0)).a;		
 		weight += w * radrad;		
 		clusterRad += radrad;
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMap.material
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMap.material	(revision 2403)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMap.material	(revision 2403)
@@ -0,0 +1,171 @@
+vertex_program GTP/PathMap_VS hlsl
+{
+   source PathMap.hlsl
+   entry_point vsWalk
+   target vs_2_0   
+}
+
+fragment_program GTP/PathMap_PS hlsl
+{
+   source PathMap.hlsl
+   entry_point psWalk
+   target ps_3_0
+   flow_control prefer
+}
+
+vertex_program GTP/PathMap_ComputeWeights_VS hlsl
+{
+   source PathMapWeightCompute.hlsl
+   entry_point vsComputeWeights
+   target vs_2_0   
+}
+
+fragment_program GTP/PathMap_ComputeWeights_PS hlsl
+{
+   source PathMapWeightCompute.hlsl
+   entry_point psComputeWeights
+   target ps_3_0   
+}
+
+fragment_program GTP/PathMap_ComputeWeights_Point_PS hlsl
+{
+   source PathMapWeightCompute.hlsl
+   entry_point psComputeWeightsPoint
+   target ps_3_0   
+}
+
+material GTP/PathMap_ComputeWeights
+{
+	technique
+	{
+		pass
+		{
+			depth_check off
+			depth_write off
+			cull_hardware none
+			scene_blend add
+			vertex_program_ref GTP/PathMap_ComputeWeights_VS
+			{
+				
+			}
+			fragment_program_ref GTP/PathMap_ComputeWeights_PS
+			{
+			}
+			texture_unit //entrypoint texture
+			{
+				filtering none
+			}
+			texture_unit shadow_map //stores distances
+   			{
+     			
+    			}
+		}
+		
+	}
+}
+
+material GTP/PathMap_ComputeWeights_Point
+{
+	technique
+	{
+		pass
+		{
+			depth_check off
+			depth_write off
+			cull_hardware none
+			scene_blend add
+			vertex_program_ref GTP/PathMap_ComputeWeights_VS
+			{
+				
+			}
+			fragment_program_ref GTP/PathMap_ComputeWeights_Point_PS
+			{
+			}
+			texture_unit //entrypoint texture
+			{
+				filtering none
+			}
+			texture_unit shadow_map //stores distances
+   			{
+     			
+    			}
+		}
+		
+	}
+}
+
+fragment_program GTP/PathMap_SumWeights_PS hlsl
+{
+   source PathMapWeightCompute.hlsl
+   entry_point psSumWeights
+   target ps_3_0
+   flow_control prefer     
+}
+
+material GTP/PathMap_SumWeights
+{
+	technique
+	{
+		pass
+		{			
+			depth_check off
+			cull_hardware none
+			vertex_program_ref GTP/PathMap_ComputeWeights_VS
+			{
+				
+			}
+			fragment_program_ref GTP/PathMap_SumWeights_PS
+			{
+			}
+			texture_unit //entrypoint texture
+			{
+				filtering none
+			}
+			texture_unit //entrypoint weight texture
+			{
+				filtering none
+			}
+			texture_unit //cluster length
+			{
+				filtering none
+			}
+		}
+		
+	}
+}
+
+vertex_program GTP/EPDisplayVS hlsl
+{
+   source PathMapWeightCompute.hlsl
+   entry_point EntryPointDisplayVS
+   target vs_2_0   
+}
+fragment_program GTP/EPDisplayPS hlsl
+{
+   source PathMapWeightCompute.hlsl
+   entry_point EntryPointDisplayPS
+   target ps_2_0   
+}
+
+material GTP/PM/EPBillboards
+{
+ technique
+ {
+   pass
+   {
+		polygon_mode points
+		point_size 10
+		vertex_program_ref GTP/EPDisplayVS
+		{
+			param_named_auto worldViewProj worldviewproj_matrix 	
+		}
+		fragment_program_ref GTP/EPDisplayPS
+		{
+		}
+    	texture_unit
+    	{  
+	    	filtering none   
+    	}
+   }
+  }
+}
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMap.hlsl
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMap.hlsl	(revision 2345)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMap.hlsl	(revision 2403)
@@ -28,5 +28,5 @@
 	output.pos = mul(WorldViewProj, input.pos);
 	output.tex = input.tex;
-	output.texAtlas = input.texAtlas;	
+	output.texAtlas = input.tex;	
 	return output;
 }
@@ -34,4 +34,6 @@
 float4	psWalk(vsOutputWalk input) : COLOR
 {
+	float2 texAtlas = input.texAtlas;
+	
 	int2 prmAtlasTiles = prmAtlasTilesHalfPixel.xy;
 	float2 atlasHalfPixel = prmAtlasTilesHalfPixel.zw;
@@ -41,14 +43,14 @@
 	{
 		float2 prmTexPos = float2(
-			(input.texAtlas.x + (iCluster % prmAtlasTiles.x)) / prmAtlasTiles.x,
-			1.0 - (input.texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y);// + atlasHalfPixel;
+			(texAtlas.x + (iCluster % prmAtlasTiles.x)) / prmAtlasTiles.x,
+			1.0 - (texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y);// + atlasHalfPixel;
 
 		float weightIndex = tex2D(clusterWeightIndexSampler, float2(((float)iCluster + 0.5) / clusterCount, 0.5)).r;
 		float3 weight = tex2D(clusterWeightSampler, float2((weightIndex + 0.5)/allClusterCount, 0.5)).rgb;
-		//weight = 0.0002 + 0.000000000001 * weight;
 		float3 val = tex2D(filteredAtlasSampler, prmTexPos).xyz;
-		if(length(val - float3(1,1,1))== 0)
-		val = 0;
-		col += val.xyz * weight;		
+		//if(length(val - float3(1,1,1))== 0)
+		//val = 0;
+		col += val.xyz * weight;	
+		//col = 0.00000000001 * col + float3(prmTexPos,1);
 	}
 	
@@ -56,8 +58,9 @@
 
 //return float4(col,1);
-	return float4(col * color, 1);
+//return float4(color + 0.0000000001 * col, 1)	;
+return float4(col * color, 1);
 
 
-	//return float4(col,1) * 0.0000000000001 + tex2D(filteredAtlasSampler, float2(input.texAtlas.x / 32.0, input.texAtlas.y));
+//return float4(col,1) * 0.0000000000001 + tex2D(filteredAtlasSampler, float2(input.texAtlas.x / 32.0, input.texAtlas.y));
 }
 
Index: P/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PRMDemo.material
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PRMDemo.material	(revision 2337)
+++ 	(revision )
@@ -1,171 +1,0 @@
-vertex_program GTP/PathMap_VS hlsl
-{
-   source PathMap.hlsl
-   entry_point vsWalk
-   target vs_2_0   
-}
-
-fragment_program GTP/PathMap_PS hlsl
-{
-   source PathMap.hlsl
-   entry_point psWalk
-   target ps_3_0
-   flow_control prefer
-}
-
-vertex_program GTP/PathMap_ComputeWeights_VS hlsl
-{
-   source PathMapWeightCompute.hlsl
-   entry_point vsComputeWeights
-   target vs_2_0   
-}
-
-fragment_program GTP/PathMap_ComputeWeights_PS hlsl
-{
-   source PathMapWeightCompute.hlsl
-   entry_point psComputeWeights
-   target ps_3_0   
-}
-
-fragment_program GTP/PathMap_ComputeWeights_Point_PS hlsl
-{
-   source PathMapWeightCompute.hlsl
-   entry_point psComputeWeightsPoint
-   target ps_3_0   
-}
-
-material GTP/PathMap_ComputeWeights
-{
-	technique
-	{
-		pass
-		{
-			depth_check off
-			depth_write off
-			cull_hardware none
-			scene_blend add
-			vertex_program_ref GTP/PathMap_ComputeWeights_VS
-			{
-				
-			}
-			fragment_program_ref GTP/PathMap_ComputeWeights_PS
-			{
-			}
-			texture_unit //entrypoint texture
-			{
-				filtering none
-			}
-			texture_unit shadow_map //stores distances
-   			{
-     			
-    			}
-		}
-		
-	}
-}
-
-material GTP/PathMap_ComputeWeights_Point
-{
-	technique
-	{
-		pass
-		{
-			depth_check off
-			depth_write off
-			cull_hardware none
-			scene_blend add
-			vertex_program_ref GTP/PathMap_ComputeWeights_VS
-			{
-				
-			}
-			fragment_program_ref GTP/PathMap_ComputeWeights_Point_PS
-			{
-			}
-			texture_unit //entrypoint texture
-			{
-				filtering none
-			}
-			texture_unit shadow_map //stores distances
-   			{
-     			
-    			}
-		}
-		
-	}
-}
-
-fragment_program GTP/PathMap_SumWeights_PS hlsl
-{
-   source PathMapWeightCompute.hlsl
-   entry_point psSumWeights
-   target ps_3_0
-   flow_control prefer     
-}
-
-material GTP/PathMap_SumWeights
-{
-	technique
-	{
-		pass
-		{			
-			depth_check off
-			cull_hardware none
-			vertex_program_ref GTP/PathMap_ComputeWeights_VS
-			{
-				
-			}
-			fragment_program_ref GTP/PathMap_SumWeights_PS
-			{
-			}
-			texture_unit //entrypoint texture
-			{
-				filtering none
-			}
-			texture_unit //entrypoint weight texture
-			{
-				filtering none
-			}
-			texture_unit //cluster length
-			{
-				filtering none
-			}
-		}
-		
-	}
-}
-
-vertex_program GTP/EPDisplayVS hlsl
-{
-   source PathMapWeightCompute.hlsl
-   entry_point EntryPointDisplayVS
-   target vs_2_0   
-}
-fragment_program GTP/EPDisplayPS hlsl
-{
-   source PathMapWeightCompute.hlsl
-   entry_point EntryPointDisplayPS
-   target ps_2_0   
-}
-
-material GTP/PM/EPBillboards
-{
- technique
- {
-   pass
-   {
-		polygon_mode points
-		point_size 10
-		vertex_program_ref GTP/EPDisplayVS
-		{
-			param_named_auto worldViewProj worldviewproj_matrix 	
-		}
-		fragment_program_ref GTP/EPDisplayPS
-		{
-		}
-    	texture_unit
-    	{  
-	    	filtering none   
-    	}
-   }
-  }
-}
