Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Sprite.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Sprite.hlsl	(revision 2310)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Sprite.hlsl	(revision 2425)
@@ -136,8 +136,156 @@
 	Color.a *= alpha;
 /// address a color map (colors of fire eg.) with the alpha
-	Color.rgb = tex2D( PlanckMap, Color.aa).rgb;
+	//Color.rgb = tex2D( PlanckMap, Color.aa).rgb;
 	
 	return Color * color; 
 }
 
-
+struct SBB_ILLUM_VS_OUT
+{
+	float4 hPosition	: POSITION;
+	float4 texCoord		: TEXCOORD0;
+	float3 P		: TEXCOORD1;
+	float3 Q		: TEXCOORD2;
+	float r			: TEXCOORD3;
+	float2 screenCoord	: TEXCOORD4;
+	float4 lightCoord	: TEXCOORD5;
+	float4 color		: COLOR0;
+};
+
+SBB_ILLUM_VS_OUT SBB_Sprite_Illum_VS (float4 position : POSITION,	
+		float4 texCoord : TEXCOORD0,
+		float4 color 	: COLOR,
+		uniform float width,
+		uniform float height,
+		uniform float4x4 worldView,
+		uniform float4x4 Proj,
+		uniform float4x4 worldViewInv,
+		uniform float4x4 lightViewProj)
+{
+	SBB_ILLUM_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;
+
+   wPosition = mul(worldViewInv, cPosition);
+   OUT.lightCoord = mul(lightViewProj, wPosition);
+
+  return OUT;
+} 
+
+
+float4 SBB_Sprite_Illum_PS(SBB_ILLUM_VS_OUT IN ,
+	//	in screenCoord : VPOS,
+	    uniform float nearplane,
+	    uniform float farplane,
+            uniform float4 color,
+	    uniform sampler2D colorTexture : register(s0),
+	    uniform sampler2D DepthMap : register(s1),
+	    uniform sampler2D illumVolume : register(s2)
+		) : COLOR
+{
+	///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;
+///////////////
+	float4 Color = IN.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 *= IN.color.a;
+	Color.a *= alpha;
+/// address a color map (colors of fire eg.) with the alpha
+	//Color.rgb = tex2D( PlanckMap, Color.aa).rgb;
+	
+	return Color * color; 
+}
+
+
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.particle
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.particle	(revision 2294)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.particle	(revision 2425)
@@ -43,4 +43,6 @@
 	
 	material		GTP/HPS/Smoke_L_Depth_Illum
+//	material GTP/HPS/Smoke_L_Depth
+
 	particle_width  1.6
     particle_height 1.6
@@ -59,4 +61,49 @@
         angle           30
         emission_rate   3
+        time_to_live    10
+        direction       0 1 0
+        velocity    	20
+        width           70       
+        height          70
+        depth           70
+    }
+    // Make em float upwards
+  //  affector LinearForce
+  //  {
+  //      force_vector      0 40 0
+  //      force_application add
+  //  }
+
+    affector ColourFader2
+    {
+       alpha1 +0.5
+       alpha2 -0.5
+       state_change 3
+    }
+}
+
+GTP/Smoke_Large
+{
+	renderer sprite
+	
+	//material		GTP/SBB/Basic
+	material		GTP/SBB/Illum
+
+	particle_width  72
+    particle_height 72
+    cull_each       false
+    quota           6000
+    sorted			true
+    //billboard_type  point
+    
+    // Area emitter
+    emitter Box
+    {
+       colour 1 1 1 0
+       //colour_range_start 1 1 1 0
+	   //colour_range_end 1 1 1 0
+
+        angle           30
+        emission_rate   60
         time_to_live    10
         direction       0 1 0
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_HPS.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_HPS.hlsl	(revision 2328)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_HPS.hlsl	(revision 2425)
@@ -165,8 +165,9 @@
 						uniform sampler2D illumVolume : register(s2),
 						uniform float farplane,
-						uniform float nearplane						
+						uniform float nearplane,
+						uniform float4 color						
 							) : COLOR
 {
-	float4 Color = 0;
+	float4 Color = IN.Color * color;
 	float4 impostor = tex2D(Texture, IN.texCoord);
 	float f = 1.0 - impostor.g;
@@ -192,5 +193,6 @@
 	
 ///final color	
-	Color = float4(1, 1, 1, alpha) * IN.Color;
+	Color.a *= alpha;
+
     return Color; 
 	
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.program
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.program	(revision 2328)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.program	(revision 2425)
@@ -28,4 +28,19 @@
 	entry_point SBB_Sprite_PS
 	target ps_2_0
+}
+
+///spherical billboard sprite programs
+vertex_program GTP/Particles/SBB_Illum_VS hlsl
+{
+	source GTP_Sprite.hlsl
+	entry_point SBB_Sprite_Illum_VS
+	target vs_2_0
+} 
+
+fragment_program GTP/Particles/SBB_Illum_PS hlsl
+{
+	source GTP_Sprite.hlsl
+	entry_point SBB_Sprite_Illum_PS
+	target ps_3_0
 }
 
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.material	(revision 2328)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.material	(revision 2425)
@@ -55,5 +55,5 @@
 	    param_named_auto farplane far_clip_distance	  
 	    param_named_auto nearplane near_clip_distance
-            param_named color float4 1 1 1 1
+            param_named color float4 1 1 1 0.1
 	 }
 	 texture_unit
@@ -70,4 +70,61 @@
 	 {
 	   texture planck.tga
+	 }
+    }
+   }
+}
+
+material GTP/SBB/Illum
+{ 
+   technique 
+   { 
+    pass 
+    {    
+        IllumTechniques
+	{ 
+         	RenderTechnique SphericalBillboard
+	        {
+			texture_unit_id		1					
+	 	}
+		RenderTechnique IllumVolume
+		{
+		    material GTP/HPS/Smoke_IllumVolume
+		    update_interval 1
+		    texture_unit_id 2
+		    resolution 128
+		    lightmatrix_param_name lightViewProj
+		}
+	}	  
+	//scene_blend src_alpha one
+	scene_blend src_alpha one_minus_src_alpha
+	depth_write off
+	depth_check off	
+	vertex_program_ref GTP/Particles/SBB_Illum_VS
+	{       
+	    param_named_auto worldView worldview_matrix
+	    param_named_auto worldViewInv inverse_worldview_matrix				
+	    param_named_auto Proj projection_matrix
+	    param_named_auto width viewport_width 	
+	    param_named_auto height viewport_height 
+	} 
+	fragment_program_ref  GTP/Particles/SBB_Illum_PS
+	{ 
+	    param_named_auto farplane far_clip_distance	  
+	    param_named_auto nearplane near_clip_distance
+            param_named color float4 1 1 1 0.5
+	 }
+	 texture_unit
+	 {
+	   anim_texture smokealpha.tga 32 2.0
+	   //texture flare.png
+	 }
+	 //scene depth texture
+	 texture_unit
+	 {
+	   filtering none
+	 }	
+	 texture_unit
+	 {
+	   
 	 }
     }
@@ -168,5 +225,6 @@
 			{ 
 				param_named_auto farplane far_clip_distance
-				param_named_auto nearplane near_clip_distance				
+				param_named_auto nearplane near_clip_distance
+				param_named color float4 1 1 1 0.5				
 			}			
 			//impostor texture
