Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/station.material
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/station.material	(revision 2489)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/station.material	(revision 2527)
@@ -263,4 +263,36 @@
 }
 
+material GTP/Station/CauCube_Point
+{
+ technique
+ {
+  pass
+  { 
+   cull_hardware none
+   scene_blend src_alpha one
+   depth_check off
+   vertex_program_ref GTP/Caustic/CauCube_PointSprite_VS
+   {
+     param_named_auto WorldView     worldview_matrix
+     param_named_auto Proj          projection_matrix
+     param_named CauSpriteSize      float 20
+   } 
+   fragment_program_ref GTP/Caustic/CauCube_Point_PS
+   {
+     param_named CausticColor float4          1 1 1 0.09
+     param_named_auto targetResolution viewport_width
+   }
+   texture_unit
+   {
+     vertex_texture true	 
+   }
+   texture_unit
+   {
+     texture PowerOfPhotonHitTexel.dds
+   }
+  }
+ }
+}
+
 material GTP/Station/CauCube_Triangles
 {
@@ -278,5 +310,5 @@
      param_named_auto Proj           projection_matrix
      param_named PhotonMapResolution float 64
-     param_named WorldSize float 0.01
+     param_named WorldSize float 0.1
    } 
    fragment_program_ref GTP/Caustic/CauCube_Triangles_PS
@@ -385,8 +417,8 @@
 				update_interval	1
 				update_all_face true
-				photonmap_resolution 128
+				photonmap_resolution 64
 				caustic_cubemap_resolution 256
 				photon_map_material	GTP/Station/PhotonMap_HitEnv
-				caustic_map_material	GTP/Station/CauCube_PointSprite
+				caustic_map_material	GTP/Station/CauCube_Point
 				//caustic_map_material	GTP/Station/CauCube_Triangles
 				//use_triangles	true
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/stationIllum.hlsl
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/stationIllum.hlsl	(revision 2507)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/stationIllum.hlsl	(revision 2527)
@@ -156,5 +156,5 @@
 }
 
-float Caustics(samplerCUBE cauMap, samplerCUBE distMap, float3 dir, float attenuation)
+float3 Caustics(samplerCUBE cauMap, samplerCUBE distMap, float3 dir, float attenuation)
 {
 	float d = length(dir);
@@ -163,4 +163,4 @@
 	caustics *= 1.0 - saturate(d / attenuation);
 	
-	return caustics.r;
+	return caustics.rgb;
 }
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/StationBase.hlsl
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/StationBase.hlsl	(revision 2507)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/Station/StationBase.hlsl	(revision 2527)
@@ -250,5 +250,5 @@
 	{
 		//Color *= 0.00000000001;
-		Color += diffuseColor * Caustics(CausticCubeMap, CausticCasterDepthMap, IN.wPos - causticCasterCenter1, causticAttenuationRange1);
+		Color.rgb += diffuseColor.rgb * Caustics(CausticCubeMap, CausticCasterDepthMap, IN.wPos - causticCasterCenter1, causticAttenuationRange1);
 	}
 	//Color.a = dist;
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.hlsl
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.hlsl	(revision 2471)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.hlsl	(revision 2527)
@@ -123,5 +123,7 @@
 		OUT.center = cPosition.xy;
 		OUT.position = cPosition;	
-		OUT.hPosition = mul(Proj, cPosition);		
+		OUT.hPosition = mul(Proj, cPosition);
+		OUT.center = float2(OUT.hPosition.x, OUT.hPosition.y) / OUT.hPosition.w;
+		
   }	
   
@@ -142,4 +144,32 @@
   IN.color = CausticColor;
   float intens = tex2D(intensityTex, IN.texCoord).r;
+  //IN.color.a *= intens;
+  IN.color *= IN.color.a * intens;
+  IN.color.a = IN.dist;
+  return IN.color;  
+}
+
+
+float4 CauCube_Point_PS(CauCube_PointSprite_VS_OUT IN,
+						uniform float targetResolution,
+						float2 pixelPos : VPOS,
+								uniform float4 CausticColor,
+								uniform sampler2D intensityTex : register(s1)
+								 ):COLOR
+{
+ IN.color = CausticColor;
+ 
+ float2 screen = pixelPos / targetResolution;
+ screen *= float2(2, 2);
+ screen -= float2(1, 1);
+ screen.y *= -1;
+ float2 texCoord = (screen - IN.center) / (IN.r / targetResolution);//(-1 , 1)
+ 
+ float intens = 1.0 - saturate(length(texCoord));
+ //return float4(intens,0,1,1);
+ //texCoord = (texCoord + 1.0) / 2.0; // (0, 1)  
+ //float intens = tex2D(intensityTex, texCoord).r;
+ 
+  
   //IN.color.a *= intens;
   IN.color *= IN.color.a * intens;
@@ -178,5 +208,5 @@
    if(pos.a == 0)//no photon hit
    {
-		OUT.color = float4(0,0,0,0);		
+		OUT.color = float4(0,1,0,1);		
 		OUT.hPosition = float4(1000000, 1000000, 1000000, 1);
    }
@@ -227,15 +257,21 @@
 		
 		float avrdist = sumdist / valids;
-		if(valids == 0) avrdist = WorldSize / 1000.0;		
+		if(valids * avrdist == 0) avrdist = WorldSize / 1000.0;		
 		
 		intensity = WorldSize / (avrdist * avrdist * 3.14);
+		intensity = min(50, max(0,intensity));
 		//intensity = 0.8;
-		
+	
+	//	if(dot(intensity, intensity) == 0)
+	//		OUT.color = float4(1,0,0,1);	
+	//	else
 		OUT.color = intensity;
-		if(notUseIntensity)
-			OUT.color = float4(1,1,1,1);		
+	
+	//	if(notUseIntensity)
+	//		OUT.color = float4(1,1,1,1);		
 	}  
   
    OUT.dist = length(pos.xyz);
+   //OUT.color = float4(0,0,0,0);
    return OUT;
 }
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.program
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.program	(revision 2040)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPCaustic/GTPCaustic.program	(revision 2527)
@@ -17,4 +17,11 @@
    source GTPCaustic.hlsl
    entry_point CauCube_PointSprite_PS
+   target ps_3_0
+}
+
+fragment_program GTP/Caustic/CauCube_Point_PS hlsl
+{
+   source GTPCaustic.hlsl
+   entry_point CauCube_Point_PS
    target ps_3_0
 }
