Index: GTP/trunk/App/Demos/Illum/Ogre/Media/Station/StationParticles.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/Station/StationParticles.material	(revision 2474)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/Station/StationParticles.material	(revision 2522)
@@ -1,2 +1,9 @@
+fragment_program GTP/Station/Large_Depth_Illum_PS hlsl
+{
+	source Station_HPS.hlsl
+	entry_point HPS_Large_Depth_Illum_PS
+	target ps_3_0
+}
+
 material GTP/Station/Smoke_L_Depth_Illum
 {
@@ -39,5 +46,5 @@
 				param_named baseRadius float 1	    										    
 			} 
-			fragment_program_ref GTP/HPS/Large_Depth_Illum_PS
+			fragment_program_ref GTP/Station/Large_Depth_Illum_PS
 			{ 
 				param_named_auto nearplane near_clip_distance
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/Station/Station_HPS.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/Station/Station_HPS.hlsl	(revision 2522)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/Station/Station_HPS.hlsl	(revision 2522)
@@ -0,0 +1,107 @@
+//////////////
+///This shader renders a HPS with depth calculation and with shading (light extintion).
+///The pixel shader identifies the two layers of the illumination volume between wich the shaded point is,
+/// and interpolates the stored extintion values.
+/////////////
+struct VS_OUT_DEPTH_ILLUM
+{
+	float4 hPosition	: POSITION;
+	float4 cPosition	: TEXCOORD1;
+	float2 texCoord		: TEXCOORD0;
+	float r				: TEXCOORD2;	
+	float4 center		: TEXCOORD3;
+	float4 Color		: TEXCOORD4;	
+	float2 screenCoord	: TEXCOORD5;
+	float4 lightCoord	: TEXCOORD6;
+};
+
+
+float4 HPS_Large_Depth_Illum_PS(VS_OUT_DEPTH_ILLUM IN,
+						uniform float nearplane,
+						uniform sampler2D Texture  : register(s0),
+						uniform sampler2D depthTexture : register(s1),
+						uniform sampler2D illumVolume : register(s2)			
+							) : COLOR
+{
+	float4 Color = 0;
+	float4 impostor = tex2D(Texture, IN.texCoord);
+	float f = 1.0 - impostor.g;
+	float b = impostor.r;
+	float alpha = 0;
+	
+	if(b == 0)
+		discard;	
+////altering opacity according to scene depth
+	float sceneDepth = tex2D(depthTexture, IN.screenCoord).r;
+	if(sceneDepth == 0)
+	{
+		discard;//alpha = impostor.a;
+	}
+	else
+	{	
+		float size = 2.0 * IN.r;
+		float frontDepth = IN.cPosition.z + size * (f - 0.5);
+		float backDepth = IN.cPosition.z +  size * (b - 0.5);
+		float B = min(sceneDepth, backDepth);
+		float F = max(frontDepth, 0.01);
+		float ds = B - F;
+		alpha = ds / (backDepth - frontDepth);
+		alpha =saturate(alpha) * impostor.a;
+	}
+	if(alpha == 0)
+		discard;
+///identify light volume slices and interpolation	
+	float2 lightCoord;
+	lightCoord = (IN.lightCoord.xy + float2(1.0, 1.0)) / 2.0;
+	lightCoord.y = 1.0 - lightCoord.y;
+	float z = IN.lightCoord.z / IN.lightCoord.w;
+		
+	float4 extintion = tex2D(illumVolume, lightCoord);
+	
+		float intensities[5];
+		intensities[0] = 1.0;
+		intensities[1] = extintion.r;
+		intensities[2] = extintion.g;
+		intensities[3] = extintion.b;
+		intensities[4] = extintion.a;
+			
+		float3 start;
+		float3 end;
+		float3 temp = 1.0;
+		float t;
+		
+		float4 planes = float4(0.33, 0.5, 0.66, 1);
+		if(z < planes.x)
+		{
+			start = intensities[0];
+			end = intensities[1];
+			t = z / planes.x;
+			temp = lerp(start, end, t);				
+		}
+		if(z > planes.x && z < planes.y)
+		{
+			start = intensities[1];
+			end = intensities[2];
+			t = (z - planes.x) / (planes.y - planes.x);
+			temp = lerp(start, end, t);					
+		}
+		if(z > planes.y && z < planes.z)
+		{
+			start = intensities[2];
+			end = intensities[3];
+			t = (z - planes.y) / (planes.z - planes.y);
+			temp = lerp(start, end, t);				
+		}
+		if(z > planes.z)
+		{
+			start = intensities[3];
+			end = intensities[4];
+			t = (z - planes.z) / (planes.a - planes.z);
+			temp = lerp(start, end, t);					
+		}
+		IN.Color.rgb *= temp;
+///final color	
+  
+	Color = float4(1, 1, 1, alpha) * IN.Color;
+    return Color;	
+}
