Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/troll.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/troll.material	(revision 2368)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/troll.material	(revision 2376)
@@ -84,4 +84,24 @@
 }
 
+material trollCameraDepth
+{
+	technique
+	{
+		pass
+		{
+			vertex_program_ref TrollSkinningSMGen
+			{
+				param_named_auto worldMatrix3x4Array[0] world_matrix_array_3x4
+				param_named_auto viewProjectionMatrix viewproj_matrix
+				param_named_auto viewMatrix view_matrix				
+			}		    
+			fragment_program_ref GTP/Basic/CDepth_PS
+		    {
+		        param_named_auto farplane far_clip_distance
+		    }  
+		}
+	}
+}
+
 material trollBase
 {
@@ -95,4 +115,5 @@
 				{
 					ILLUM_TRIGGER_SM_POINT trollShadowMapGen_POINT
+					ILLUM_TRIGGER_CAMERADEPTH trollCameraDepth
 				}
 			}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material	(revision 2373)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material	(revision 2376)
@@ -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 2
+					max_light_count 1
 					set_light_viewproj false
 					set_light_view true
@@ -56,5 +56,6 @@
    			  param_named_auto lightColor1 light_diffuse_colour 0
    			  param_named_auto lightColor2 light_diffuse_colour 1
-   			  param_named specularity float 120
+   			  param_named specularity float 20
+   			  param_named specularColor float4 0.2 0.2 0.2 0.2   			  
    			}
    			texture_unit tile_texture
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl	(revision 2373)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl	(revision 2376)
@@ -41,4 +41,5 @@
 
 uniform float specularity;
+uniform float4 specularColor;
 
 
@@ -96,29 +97,39 @@
 //light1		
 	//light dir
-	float3 L = wLightPos1.xyz - IN.wPos * wLightPos1.w;
+float3 L;
+float4 col;
+float3 lightCPos;
+float shadow;
+
+if(dot(lightColor1, lightColor1) != 0)
+{
+	L = wLightPos1.xyz - IN.wPos * wLightPos1.w;
 	//illumination
-	float4 col;
-	col = Illumination(N, L, V, lightColor1 * lightPower1, lightRange1, diffuseColor, specularity);
+	col = Illumination(N, L, V, lightColor1 * lightPower1, lightRange1, diffuseColor, specularity, specularColor);
 	//shadowing	
-	float3 lightCPos = mul(LightView1, float4(IN.wPos, 1)).xyz;
-	float shadow = shadowPoint(ShadowMap1Point, lightCPos, lightFarPlane1);
+	lightCPos = mul(LightView1, float4(IN.wPos, 1)).xyz;
+	shadow = shadowPoint(ShadowMap1Point, lightCPos, lightFarPlane1);
 	Color += col * shadow;	
+}
 
 //----------------------------------------------------------------------------------------------------------------
 //light2			
+/*if(dot(lightColor2, lightColor2) != 0)
+{
 	//light dir
 	L = wLightPos2.xyz - IN.wPos * wLightPos2.w;
 	//illumination
-	col = Illumination(N, L, V, lightColor2 * lightPower2, lightRange2, diffuseColor, specularity);
+	col = Illumination(N, L, V, lightColor2 * lightPower2, lightRange2, diffuseColor, specularity, specularColor);
 	//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;
+//	float4 indirect = PathMapIndirect(PathMap, WeightIndexMap, WeightMap, IN.texCoord2.zw) * 1.2;
+//	indirect *= diffuseColor;
+//	Color = Color + indirect;
 	
 	//gather caustics for all casters
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.particle
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.particle	(revision 2376)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.particle	(revision 2376)
@@ -0,0 +1,53 @@
+
+MoriaDust
+{
+	quota	200
+	material	MoriaDust
+	particle_width	25
+	particle_height	25
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	renderer sprite
+	
+	emitter Box
+	{
+		angle	180
+		colour	1 1 1 0
+		colour_range_start	1 1 1 0
+		colour_range_end	1 1 1 0
+		direction	0 1 0
+		emission_rate	64.52
+		position	0 0 0
+		velocity_min	0.1
+		velocity_max	0.3
+		time_to_live	2.258
+		time_to_live_min	2.258
+		time_to_live_max	18.06
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	40
+		height	40
+		depth	10
+	}
+
+	affector ColourFader2
+	{
+		red1	0
+		green1	0
+		blue1	0
+		alpha1	0.3
+		red2	0
+		green2	0
+		blue2	0
+		alpha2	-0.3
+		state_change	12.26
+	}
+}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/illum.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/illum.hlsl	(revision 2373)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/illum.hlsl	(revision 2376)
@@ -1,4 +1,4 @@
 
-float4 Illumination(float3 N, float3 L, float3 V, float4 lightColor, float4 lightRange, float4 diffuseColor, float specularity)
+float4 Illumination(float3 N, float3 L, float3 V, float4 lightColor, float4 lightRange, float4 diffuseColor, float specularity, float4 specularColor)
 {
 	// Blinn lighting
@@ -8,5 +8,5 @@
 	float4 Lighting = lit(dot(N, L), dot(N, H), specularity);
 	
-	return   lightColor * (Lighting.y * diffuseColor + Lighting.z) //color
+	return   lightColor * (Lighting.y * diffuseColor + Lighting.z * specularColor) //color
 			 / (lightRange.y + d * lightRange.z + d * d * lightRange.w) //attenuation
 			 ;
@@ -64,5 +64,5 @@
 	
 	float3 col = 0;
-	for(int iCluster = 0; iCluster < 32; iCluster++)
+	for(int iCluster = 0; iCluster < 8; iCluster++)
 	{
 		float2 prmTexPos = float2(
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.material	(revision 2376)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.material	(revision 2376)
@@ -0,0 +1,61 @@
+vertex_program Moria/MoriaDust_VS hlsl
+{
+	source MoriaDust.hlsl
+	entry_point MoriaDust_VS
+	target vs_2_0
+} 
+
+fragment_program Moria/MoriaDust_PS hlsl
+{
+	source MoriaDust.hlsl
+	entry_point MoriaDust_PS
+	target ps_2_0
+} 
+
+material MoriaDust
+{
+	technique
+	{
+		pass
+		{
+			IllumTechniques
+			{ 
+		        RenderTechnique SphericalBillboard
+			    {
+				  		texture_unit_id		1					
+			 	}
+			}	
+
+			depth_check off
+			depth_write off
+			scene_blend src_alpha one
+			//scene_blend alpha_blend
+			vertex_program_ref Moria/MoriaDust_VS
+			{       
+			    param_named_auto worldView worldview_matrix
+			    param_named_auto Proj projection_matrix
+			    param_named_auto width viewport_width 	
+			    param_named_auto height viewport_height 
+			} 
+			fragment_program_ref  Moria/MoriaDust_PS
+			{ 
+			    param_named_auto farplane far_clip_distance	  
+			    param_named_auto nearplane near_clip_distance
+		        param_named color float4 0.55 0.56 0.5 2.5
+		        param_named symmetry float 0.1	
+		        param_named_auto lightCPos light_position_view_space 0
+			}
+			texture_unit
+			{
+				texture dust.dds
+			}
+			texture_unit //scene depth
+			{
+			}
+			texture_unit
+			{
+				texture phasefunction.jpg
+			}
+		}
+	}
+}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.hlsl	(revision 2376)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaDust.hlsl	(revision 2376)
@@ -0,0 +1,93 @@
+struct SBB_VS_OUT
+{
+	float4 hPosition	: POSITION;
+	float4 texCoord		: TEXCOORD0;
+	float3 P		: TEXCOORD1;
+	float3 Q		: TEXCOORD2;
+	float r			: TEXCOORD3;
+	float2 screenCoord	: TEXCOORD4;	
+	float4 color		: COLOR0;
+};
+
+SBB_VS_OUT MoriaDust_VS (float4 position : POSITION,	
+		float4 texCoord : TEXCOORD0,
+		float4 color 	: COLOR,
+		uniform float width,
+		uniform float height,
+		uniform float4x4 worldView,
+		uniform float4x4 Proj)
+{
+	SBB_VS_OUT OUT;
+ ///transform to camera space and create a sprite with vertex offset 
+	float2 offset = texCoord.zw;
+	float4 cPosition;   
+	float4 wPosition = position;    
+	cPosition = mul(worldView, wPosition);
+/// P is the particle sphere center	
+	OUT.P = cPosition.xyz;
+	OUT.P.z = - 1 * OUT.P.z;
+	cPosition.xy += offset;
+/// Q is the shaded point (it is moved backwards to avoid unwanted frontplane clipping)				
+	OUT.Q = cPosition.xyz;	
+	OUT.Q.z = OUT.P.z;
+	OUT.r = abs(texCoord.z);   
+/// calculate screen space position 
+   OUT.hPosition = mul( Proj, cPosition );
+   OUT.screenCoord =  (OUT.hPosition.xy / OUT.hPosition.w + 1.0) / 2.0;
+   OUT.screenCoord.y = 1.0 - OUT.screenCoord.y;
+   OUT.screenCoord += float2(0.5/width, 0.5/height);   
+   
+   OUT.texCoord = texCoord;
+   OUT.color = color;
+
+  return OUT;
+} 
+
+
+float4 MoriaDust_PS(SBB_VS_OUT IN ,
+	//	in screenCoord : VPOS,
+	    uniform float nearplane,
+	    uniform float farplane,
+	    uniform float4 lightCPos,
+        uniform float4 color,
+        uniform float symmetry,
+	    uniform sampler2D colorTexture : register(s0),
+	    uniform sampler2D DepthMap : register(s1),
+	    uniform sampler2D PhaseMap : register(s2)
+	   ) : COLOR
+{
+	float4 Color = IN.color * color;
+	float alpha = 0;
+	
+/// get the depth values from the depthMap and calculate ray length in sphere	
+	float d = length( IN.Q - IN.P );
+	float Zs;
+	if( d < IN.r )
+	{
+	 
+	 float w = sqrt( IN.r * IN.r - d * d );
+	 alpha = w / IN.r;
+	 alpha *= pow( (IN.r-d) / IN.r , 2);
+	
+	 float F = IN.Q.z - w;
+	 float B = IN.Q.z + w; 
+	 
+
+	 Zs = tex2D( DepthMap, IN.screenCoord ).r;
+	 if(Zs == 0) Zs = farplane;
+	 float ds = min( Zs, B ) - max( nearplane, F );	 
+	// float ds = min( Zs, B ) - F;	 
+	 alpha *=  ds / w * 0.5;
+	}
+/// fetch opacity from a texture
+	Color.a *= tex2D( colorTexture, IN.texCoord.xy).r;
+	Color.a *= alpha;
+	
+	//illumination
+	float3 L = normalize(lightCPos - IN.Q * lightCPos.w);
+	float3 V = normalize(-IN.Q);
+	float phase = tex2D(PhaseMap, float2(symmetry, dot(L,V)) * 0.5 + 0.5).r;
+//	float phase = (dot(L, V) + 1.0) * 0.5;
+	Color.rgb *= phase;
+	return Color; 
+}
