Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Blur.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Blur.hlsl	(revision 2368)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Blur.hlsl	(revision 2373)
@@ -24,5 +24,5 @@
 			uniform float height ) : COLOR
 {  
-
+/*
   float2 pixel = float2(1.0 / width, 1.0 / height);
   float2 uv = IN.Position + pixel * 0.5;
@@ -35,7 +35,14 @@
 
   sum /= samplesU * samplesV;
-
-  return sum;
-  return tex2D(Texture, uv);
+*/
+  float du = 2.0 / width;
+  float dv = 2.0 / height;
+  float2 uv = IN.Position;
+  float4 sum = float4(0,0,0,0);  
+  sum += tex2D(Texture,uv);
+  sum += tex2D(Texture,uv + float2(du,0));
+  sum += tex2D(Texture,uv + float2(du,dv));
+  sum += tex2D(Texture,uv + float2(0,dv));
+  return sum / 4.0;
 }
 
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl	(revision 2368)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl	(revision 2373)
@@ -26,6 +26,17 @@
 uniform float3 wCamPos;
 
-uniform float4x4 LightView[MAX_LIGHT];
-uniform float lightFarPlane[MAX_LIGHT];
+uniform float4 wLightPos1;
+uniform float4 wLightPos2;
+uniform float4 lightRange1;
+uniform float4 lightRange2;
+uniform float lightPower1;
+uniform float lightPower2;
+uniform float4 lightColor1;
+uniform float4 lightColor2;
+						
+uniform float4x4 LightView1;
+uniform float4x4 LightView2;
+uniform float lightFarPlane1;
+uniform float lightFarPlane2;
 
 uniform float specularity;
@@ -36,5 +47,5 @@
 	float4 hPos : POSITION;
 	float4 texCoord   	  : TEXCOORD0;
-	float2 bumpTexCoord   : TEXCOORD1;
+	float4 texCoord2      : TEXCOORD1;
 	float3 wView		  : TEXCOORD2;
 	float3 wTangent 	  : TEXCOORD3;
@@ -48,4 +59,5 @@
 										float2 texCoord1 : TEXCOORD0,
 										float2 texCoord2 : TEXCOORD1,
+										float2 atlasTex  : TEXCOORD2,
 										float3 tangent   : TEXCOORD3,
 										uniform float normalCoord)
@@ -55,7 +67,9 @@
 	OUT.texCoord = float4(texCoord1.xy, texCoord2.xy);	
 	if(normalCoord == 0)
-		OUT.bumpTexCoord = texCoord1;
+		OUT.texCoord2.xy = texCoord1;
 	else
-		OUT.bumpTexCoord = texCoord2;
+		OUT.texCoord2.xy = texCoord2;
+	
+	OUT.texCoord2.zw = atlasTex;
 		
 	OUT.hPos = mul(WorldViewProj, position);
@@ -71,27 +85,41 @@
 }
 
-float4 MoriaHallBase_PS(MORIA_HALL_BASE_VSOUT IN,
-						uniform float4 wLightPos,
-						uniform float4 lightRange,
-						uniform float lightPower,
-						uniform float4 lightColor):COLOR0
+float4 MoriaHallBase_PS(MORIA_HALL_BASE_VSOUT IN):COLOR0
 {	
 	float4 Color = 0;
-	float3 N = NormalMap(IN.wTangent, IN.wBinormal, IN.wNormal, IN.bumpTexCoord, bumpMap);
+	float3 N = NormalMap(IN.wTangent, IN.wBinormal, IN.wNormal, IN.texCoord2.xy, bumpMap);
 	float3 V = normalize(IN.wView);
 	// read textures
 	float4 diffuseColor = tex2D(tileTexture, IN.texCoord.zw) * tex2D(detailTexture, IN.texCoord.xy);
-		
+	
+//----------------------------------------------------------------------------------------------------------------
+//light1		
 	//light dir
-	float3 L = wLightPos.xyz - IN.wPos * wLightPos.w;
+	float3 L = wLightPos1.xyz - IN.wPos * wLightPos1.w;
 	//illumination
 	float4 col;
-	col = Illumination(N, L, V, lightColor * lightPower, lightRange, diffuseColor, specularity);
-	//shadowing
-	float3 lightCPos = mul(LightView[0], float4(IN.wPos, 1)).xyz;
-	float shadow = shadowPoint(ShadowMap1Point, lightCPos, lightFarPlane[0]);
+	col = Illumination(N, L, V, lightColor1 * lightPower1, lightRange1, diffuseColor, specularity);
+	//shadowing	
+	float3 lightCPos = mul(LightView1, float4(IN.wPos, 1)).xyz;
+	float shadow = shadowPoint(ShadowMap1Point, lightCPos, lightFarPlane1);
+	Color += col * shadow;	
+
+//----------------------------------------------------------------------------------------------------------------
+//light2			
+	//light dir
+	L = wLightPos2.xyz - IN.wPos * wLightPos2.w;
+	//illumination
+	col = Illumination(N, L, V, lightColor2 * lightPower2, lightRange2, diffuseColor, specularity);
+	//shadowing	
+	lightCPos = mul(LightView2, float4(IN.wPos, 1)).xyz;
+	shadow = shadowPoint(ShadowMap2Point, lightCPos, lightFarPlane2);
 	Color += col * shadow;	
 	
 	//do Path Map to gather indirect illumination
+	
+	float4 indirect = PathMapIndirect(PathMap, WeightIndexMap, WeightMap, IN.texCoord2.zw) * 1.2;
+	indirect *= diffuseColor;
+	Color = Color + indirect;
+	
 	//gather caustics for all casters
 	//return diffuseColor;
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material	(revision 2368)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material	(revision 2373)
@@ -21,12 +21,12 @@
   			IllumTechniques
 			{
-				//RenderTechnique PathMap
-			 	//{
-			    //	new_passes false
-				//	start_tex_id 3
-			  	//}	
+				RenderTechnique PathMap
+			 	{
+			    	new_passes false
+					start_tex_id 3
+			  	}	
 			 	RenderTechnique DepthShadowReceiver
 				{
-					max_light_count 1
+					max_light_count 2
 					set_light_viewproj false
 					set_light_view true
@@ -48,12 +48,12 @@
   			fragment_program_ref GTP/MoriaDemo/MoriaHallBase_PS
   			{ 
-	  		  param_named_auto wLightPos light_position 0
-   			  //param_named_auto wLightPos light_position 1   			  
-	  		  param_named_auto lightRange light_attenuation 0
-  			  //param_named_auto lightRange[1] light_attenuation 1
-   			  param_named_auto lightPower light_power 0
-   			  //param_named_auto lightPower[1] light_power 1
-   			  param_named_auto lightColor light_diffuse_colour 0
-   			  //param_named_auto lightColor[1] light_diffuse_colour 1
+	  		  param_named_auto wLightPos1 light_position 0
+   			  param_named_auto wLightPos2 light_position 1   			  
+	  		  param_named_auto lightRange1 light_attenuation 0
+  			  param_named_auto lightRange2 light_attenuation 1
+   			  param_named_auto lightPower1 light_power 0
+   			  param_named_auto lightPower2 light_power 1
+   			  param_named_auto lightColor1 light_diffuse_colour 0
+   			  param_named_auto lightColor2 light_diffuse_colour 1
    			  param_named specularity float 120
    			}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/illum.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/illum.hlsl	(revision 2368)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/illum.hlsl	(revision 2373)
@@ -53,2 +53,29 @@
 	  return (SHADOW_COLOR + (1 - SHADOW_COLOR) * light);
 }
+
+uniform float4 prmAtlasTilesHalfPixel;
+uniform float allClusterCount; 
+uniform float clusterCount;
+
+float4 PathMapIndirect(sampler2D PMTex, sampler2D weightIndexTex, sampler2D weightTex, float2 texAtlas)
+{
+	int2 prmAtlasTiles = prmAtlasTilesHalfPixel.xy;
+	float2 atlasHalfPixel = prmAtlasTilesHalfPixel.zw;
+	
+	float3 col = 0;
+	for(int iCluster = 0; iCluster < 32; iCluster++)
+	{
+		float2 prmTexPos = float2(
+			(texAtlas.x + (iCluster % prmAtlasTiles.x)) / prmAtlasTiles.x,
+			1.0 - (texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y);// + atlasHalfPixel;
+
+		float weightIndex = tex2D(weightIndexTex, float2(((float)iCluster + 0.5) / clusterCount, 0.5)).r;
+		float3 weight = tex2D(weightTex, float2((weightIndex + 0.5)/allClusterCount, 0.5)).rgb;
+		float3 val = tex2D(PMTex, prmTexPos).xyz;
+		if(length(val - float3(1,1,1))== 0)
+		val = 0;
+		col += val.xyz * weight;		
+	}
+	
+	return float4(col,1);
+}
Index: GTP/trunk/App/Demos/Illum/Ogre/src/Moria/include/Moria.h
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/src/Moria/include/Moria.h	(revision 2367)
+++ GTP/trunk/App/Demos/Illum/Ogre/src/Moria/include/Moria.h	(revision 2373)
@@ -182,5 +182,5 @@
 		mainLightNode = rootNode->createChildSceneNode();
 		
-		mainLightNode->setPosition(15,10,15);		
+		mainLightNode->setPosition(15,5,15);		
 		mainLight->setPowerScale(30);
 		//mainLight->setDirection(1,0, 0);
@@ -189,4 +189,14 @@
 		mainLight->setAttenuation(40.0, 0, 4, 0);
 
+		Light* blueLight = mSceneMgr->createLight("blueLight");
+		blueLight->setType(Light::LT_POINT);
+		blueLight->setCastShadows(true);
+		blueLight->setDiffuseColour(ColourValue(0.45,0.75,0.8));
+		blueLight->setPowerScale(30);
+		blueLight->setAttenuation(40.0, 0, 4, 0);
+		SceneNode* blueLightNode = rootNode->createChildSceneNode();
+		blueLightNode->setPosition(15,10,15);
+		blueLightNode->attachObject(blueLight);
+		
 		Vector4 v = mainLight->getAs4DVector();
 
@@ -240,5 +250,5 @@
 		mRoot->addFrameListener(mFrameListener);
 		OgreIlluminationManager::getSingleton().setPriority(3);
-		mRoot->addFrameListener(&OgreIlluminationManager::getSingleton());
+	   mRoot->addFrameListener(&OgreIlluminationManager::getSingleton());
     }
 
