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 2024)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPParticles/GTP_Particles.particle	(revision 2294)
@@ -48,5 +48,5 @@
     quota           200
     sorted			true
-    billboard_type  point
+    //billboard_type  point
     
     // Area emitter
@@ -90,5 +90,5 @@
     cull_each       false
     quota           400
-    billboard_type  point
+    //billboard_type  point
     
     // Area emitter
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Phong.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Phong.hlsl	(revision 1671)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Phong.hlsl	(revision 2294)
@@ -110,10 +110,10 @@
 		uniform float4x4 worldViewProj,
 		uniform float4x4 worldView,
-		uniform float4x4 worldViewIT)
+		uniform float4x4 worldViewI)
 {
   vertOUT OUT;
   OUT.hPos = OUT.hPosition = mul(worldViewProj, position);
   OUT.wPos = mul(worldView, position).xyz;  
-  OUT.mNormal = mul(worldViewIT, normal).xyz;
+  OUT.mNormal = mul(normal, worldViewI).xyz;
   //OUT.mNormal = normal;
   OUT.texCoord = texCoord;  
@@ -160,8 +160,5 @@
 	   uniform float4 diffuse,
 	   uniform float4 ambient,
-	   uniform sampler2D colorTexture,
-	   uniform float4x4 worldViewIT          
-
-            ) : COLOR0
+	   uniform sampler2D colorTexture ) : COLOR0
 {
    
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_ReduceCubeMap.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_ReduceCubeMap.hlsl	(revision 1519)
+++ 	(revision )
@@ -1,68 +1,0 @@
-
-int CUBEMAP_SIZE = 128;
-int RATE = 32;
-int nFace;
-
-float4 readCubeMap(samplerCUBE cm, float3 coord)		
-{
-	float4 color = texCUBE( cm, float3(coord.xy, coord.z) );
-	return color;
-}
-
-
-struct VS_INPUT {           // vertex shader input
-    float4 Position : POSITION;
-};
-
-struct VS_OUTPUT {          // vertex shader output, pixel shader input
-    float4 hPosition : POSITION;
-    float2 Position  : TEXCOORD0;
-};
-
-VS_OUTPUT ReduceTextureVS(VS_INPUT IN) {
-	VS_OUTPUT OUT;
-    OUT.hPosition = IN.Position;
-    OUT.Position = IN.Position.xy;
-    //OUT.Position.y = 1 - OUT.Position.y;
-    return OUT;
-}
-
-float4 ReduceTexturePS(VS_OUTPUT IN,
-						uniform samplerCUBE EnvironmentMapSampler : register(s0) ) : COLOR
-{  
-	RATE = 32;
-	CUBEMAP_SIZE = 128;
-    float4 color = 0;
-    // color += texCUBE( EnvironmentMapSampler, Tex );
-    float3 dir;
-  
-   for (int i = 0; i < RATE; i++)
-     for (int j = 0; j < RATE; j++)
-    {
-		float2 pos;
-		pos.x = IN.Position.x + (2*i + 1)/(float)CUBEMAP_SIZE;
-		pos.y = IN.Position.y - (2*j + 1)/(float)CUBEMAP_SIZE;	// y=-u
-
-		// "scrambling"
-		if (nFace == 0)	dir = float3(1, pos.y, -pos.x);
-		if (nFace == 1) dir = float3(-1, pos.y, pos.x);
-		if (nFace == 2) dir = float3(pos.x, 1, -pos.y);
-		if (nFace == 3) dir = float3(pos.x, -1, pos.y);
-		if (nFace == 4) dir = float3(pos.x, pos.y, 1);
-		if (nFace == 5) dir = float3(-pos.x, pos.y,-1);
-
-		color += texCUBE( EnvironmentMapSampler, dir);
-    }
-  /*  
-    if (nFace == 0)	dir = float3(1, 0, 0);
-	if (nFace == 1) dir = float3(-1, 0, 0);
-	if (nFace == 2) dir = float3(0, 1, 0);
-	if (nFace == 3) dir = float3(0, -1, 0);
-	if (nFace == 4) dir = float3(0, 0, 1);
-	if (nFace == 5) dir = float3(0, 0,-1);
-		
-    return texCUBE(EnvironmentMapSampler, dir);*/
-    //return float4(IN.Position.xy,1,1);
-	return color / (RATE*RATE);	
-	
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Depth.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Depth.hlsl	(revision 777)
+++ 	(revision )
@@ -1,35 +1,0 @@
-float farplane = 100.0;
-float nearplane = 0.1;
-
-struct VS_OUT
-{
-	float4 hPosition	: POSITION;
-	float4 Position	: TEXCOORD0;
-};
-
-VS_OUT hDepthVS(float4 position : POSITION,	
-		uniform float4x4 worldView,
-		uniform float4x4 worldViewProj)
-{
-  VS_OUT OUT;
-  OUT.hPosition = mul(worldViewProj, position);
-  OUT.Position = ( OUT.hPosition / OUT.hPosition.w + 1) / 2.0;
-  return OUT;
-}
-
-VS_OUT cDepthVS(float4 position : POSITION,	
-		uniform float4x4 worldView,
-		uniform float4x4 worldViewProj)
-{
-  VS_OUT OUT;
-  OUT.hPosition = mul(worldViewProj, position);
-  OUT.Position = mul(worldView, position);
-  OUT.Position.z *= -1.0;
-  return OUT;
-}
-
-
-float4 DepthPS(VS_OUT IN ):COLOR
-{
-	return float4(IN.Position.z, IN.Position.z, IN.Position.z, 1);	
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl	(revision 1929)
+++ 	(revision )
@@ -1,338 +1,0 @@
-float3 F0;
-
-float4 readCubeMap(samplerCUBE cm, float3 coord)		
-{
-	float4 color = texCUBElod( cm, float4(coord.xy, - coord.z,0) );
-	return color;
-}
-
-float readDistanceCubeMap(samplerCUBE dcm, float3 coord)		
-{
-	float dist = texCUBElod(dcm, float4(coord.xy, - coord.z,0)).a;
-	return dist;
-}
-
-
-
-#define MAX_LIN_ITERATIONCOUNT 20
-#define MIN_LIN_ITERATIONCOUNT 6
-#define SECANT_ITERATIONCOUNT 1
-
-float Hit(float3 x, float3 R, samplerCUBE mp, out float3 newDir)
-{
-	R = normalize(R);
-	
-	float3 Ra = abs(R);
-	float3 xa = abs(x);
-	
-    float xm =  max(max(xa.x,xa.y),xa.z);
-    float Rm = max(max(Ra.x,Ra.y),Ra.z);
-    
-    float a = xm / Rm;
-    
-  
-    float dt =  length(x / xm - R / Rm) * MAX_LIN_ITERATIONCOUNT;
-    dt = max(dt, MIN_LIN_ITERATIONCOUNT);
-    dt = 1.0 / dt;
-    
-    	
-	bool overshoot = false, undershoot = false;
-	float dp, dl = 0, ppp, llp;
-	float lR = readDistanceCubeMap(mp, R);
-	//float3 p = R;
-	float3 p = 0;
-		
-	//linear iteration	
-	float t;
-	float dist = 0;
-	/*
-	t = 0.9999999999999;
-	dp = a * t / (1 - t);
-	p = x + R * dp;
-	dist = readDistanceCubeMap(mp, p);
-	ppp = length(p) / dist;
-	*/
-	t = 0.01;	
-		
-	while(t <= 1.0 && !overshoot)
-	{
-		dp = a * t / (1 - t);
-		p = x + R * dp;
-		float dist = readDistanceCubeMap(mp, p);
-		if(dist > 0)
-		{
-			bool us = false;
-			
-			ppp = length(p) / dist;			
-			if(ppp < 1)
-			us = true;
-				
-			us = !us;
-			
-			if(us)
-			{
-				dl = dp;
-				llp = ppp;		
-				undershoot = true;		
-			}
-			else
-			{
-				if (undershoot) 
-				   overshoot = true;
-			}
-		}
-		else
-			undershoot = false;
-	
-		t += dt;		
-	}
-	
-	//if(t >= 1.0 && undershoot && dist)
-	//	overshoot = true;	
-	
-	if(overshoot)
-	{
-		float dnew;
-		for(int i = 0; i < SECANT_ITERATIONCOUNT; i++ )
-		{
-			dnew = dl + (dp - dl) * (1 - llp) / (ppp - llp);	
-			    
-			p = x + R * dnew;
-			half pppnew = length(p) / readDistanceCubeMap(mp, p);
-			if(pppnew < 1)
-			{
-				llp = pppnew;
-				dl = dnew;
-			}
-			else
-			{
-				ppp = pppnew;
-				dp = dnew;
-			}
-		}	
-	}
-	else
-		p = float3(0,0,0);
-	
-	newDir = p; 
-	return dp;
-}
-			
-
-float HitOld( float3 x, float3 R, samplerCUBE mp, out float3 newDir )
-{
-	//return R  + 0.00000000001 * x;
-	float rl = readDistanceCubeMap( mp, R);				// |r|
-	
-	float ppp = length( x ) /  readDistanceCubeMap( mp, x);			// |p|/|p|
-	float dun = 0, pun = ppp, dov = 0, pov = 0;
-	float dl = rl * ( 1 - ppp );							// eq. 2
-	float3 l = x + R * dl;									// ray equation
-
-	// iteration
-	for( int i = 0; i < SECANT_ITERATIONCOUNT; i++ )	
-	{
-		float llp = length( l ) / readDistanceCubeMap( mp, l);		// |l|/|l|
-		if ( llp < 0.999f )									// undershooting
-		{
-			dun = dl; pun = llp;							// last undershooting
-			dl += ( dov == 0 ) ? rl * ( 1 - llp ) :			// eq. 2
-				( dl - dov ) * ( 1 - llp ) / ( llp - pov );	// eq. 3
-		} else if ( llp > 1.001f )							// overshooting
-		{
-			dov = dl; pov = llp;							// last overshooting
-			dl += ( dl -dun ) * ( 1 - llp ) / ( llp - pun );// eq. 3
-		}
-		l = x + R * dl;										// ray equation
-	}
-	newDir = l;												// computed hit point
-	
-	return dl;
-}
-
-
-struct VertOut
-{
-	float3 wPos	: TEXCOORD1;
-	float3 cPos	: TEXCOORD3;
-	float2 texCoord : TEXCOORD0;
-	float3 mNormal  : TEXCOORD2;
-	float4 hPos : POSITION;			
-};
-
-VertOut DefaultVS(float4 position : POSITION,						
-				float2 texCoord : TEXCOORD0,
-				float3 normal   : NORMAL,
-				uniform float4x4 worldViewProj,
-				uniform float4x4 world,
-				uniform float4x4 worldview,
-				uniform float4x4 worldI	)
-{
-  VertOut OUT;
-  OUT.hPos = mul(worldViewProj, position);
-  OUT.wPos = mul(world, position).xyz;  
-  OUT.cPos = mul(worldview, position).xyz;  
-  OUT.mNormal = mul(normal, worldI);  
-  //OUT.mNormal = normal;
-  OUT.texCoord = texCoord;
-  return OUT;
-}
-
-//////////////
-//Metal
-//////////////
-float4 Metal1BouncePS(  VertOut IN,
-		uniform float3 cameraPos,
-		uniform samplerCUBE CubeMap : register(s0),
-		uniform samplerCUBE DistanceMap : register(s1),
-		uniform float3 lastCenter):COLOR0
-{
-	
-	float4 Color = float4(1,1,1,1);
-	
-	IN.mNormal = normalize(IN.mNormal);
-	float3 newTexCoord;	
-	float3 mPos = IN.wPos - lastCenter;
-	float3 V  = (IN.wPos - cameraPos);
-	float cameraDistace = length(V);
-	V = normalize(V);
-	float3 R = normalize(reflect( V, IN.mNormal));
-		
-	newTexCoord = R;	
-	HitOld(mPos, R, DistanceMap, newTexCoord);
-	Color = readCubeMap(CubeMap, newTexCoord );	
-	
-	float ctheta_in = dot(IN.mNormal,R);
-	float ctheta_out = dot(IN.mNormal,-V);
-
-	float3 F = 0;
-	
-	// F,P,G számítása
-	if ( ctheta_in > 0 && ctheta_out > 0 )
-	{
-		float3 H = normalize(R - V);	// felezõvektor
-		float cbeta  = dot(H,R);		
-		F = F0 + (1-F0)*pow(1-cbeta,5);
-	}	
-	
-	Color = Color * float4(F,1);
-	
-	return Color;	
-}
-
-
-void MetalMultipleBouncePS(  VertOut IN,
-		uniform float3 cameraPos,
-		uniform samplerCUBE CubeMap : register(s0),
-		uniform samplerCUBE DistanceMap : register(s1),
-		uniform samplerCUBE NormDistMap1 : register(s2),
-		uniform samplerCUBE NormDistMap2 : register(s3),
-		uniform float3 lastCenter,
-		uniform float SingleBounce,
-		out float4 Color :COLOR0)
-{
-	//if(SingleBounce == 1)
-	// Color = Metal1BouncePS(IN,cameraPos,CubeMap,DistanceMap,lastCenter);
-	//else
-	//{
-		Color = float4(1,1,1,1);
-		
-		IN.mNormal = normalize(IN.mNormal);
-		float3 newTexCoord;	
-		float3 mPos = IN.wPos - lastCenter;
-		float3 V  = (IN.wPos - cameraPos);
-		float cameraDistace = length(V);
-		V = normalize(V);
-		float3 R = normalize(reflect( V, IN.mNormal));
-		//float3 R = normalize(refract( V, IN.mNormal, 0.98));
-			
-		newTexCoord = R;
-		
-		//Color = readCubeMap(NormDistMap2, mPos );
-		//return;
-		
-
-		float3 newDir1;
-		float d1 = Hit(mPos, R, NormDistMap1, newDir1);
-		float3 normal1 = readCubeMap(NormDistMap1, newDir1).rgb;
-		bool valid1 = /*dot(normal1, R) < 0 &&*/ dot(newDir1,newDir1) != 0;
-		if(valid1)
-			newDir1 = 0;
-		float3 newDir2;
-		float d2 = Hit(mPos, R, NormDistMap2, newDir2);
-		float3 normal2 =  readCubeMap(NormDistMap2, newDir2).rgb;
-		bool valid2 = /*dot(normal2, R) < 0 &&*/ dot(newDir2,newDir2) != 0;
-		if(valid2)
-			newDir2 = 0;
-			
-		if( !valid1 && !valid2)
-		{
-		//	Hit(mPos, R, DistanceMap, newTexCoord);	
-		//	Color = readCubeMap(CubeMap, newTexCoord );
-			//Color = 1;			
-		}
-		else
-		{		
-			float d;
-			float3 newN;
-			
-			d = d2;
-			newN = normal2;
-			
-			Color = float4(0,0,1,1);
-			if( !valid2 || (valid1 && d1 < d2)  )
-			{
-				d = d1;
-				newN = normal1;
-				Color = float4(0,1,0,1);
-			}
-			
-			float3 newV = R;
-			float3 newX = mPos + R * d;
-			float3 newR = normalize(reflect( newV, newN));
-		//	float3 newR = normalize(refract( newV, newN, 0.98));
-		
-			Hit(newX, newR, DistanceMap, newTexCoord);	
-			Color = readCubeMap(CubeMap, newTexCoord );
-			//Color = float4(newR,1);
-			//Color = float4(1,0,0,1);	
-		}
-		
-/*
-		return;
-		
-		float ctheta_in = dot(IN.mNormal,R);
-		float ctheta_out = dot(IN.mNormal,-V);
-
-		float3 F = 0;
-		
-		// F,P,G számítása
-		if ( ctheta_in > 0 && ctheta_out > 0 )
-		{
-			float3 H = normalize(R - V);	// felezõvektor
-			float cbeta  = dot(H,R);		
-			F = F0 + (1-F0)*pow(1-cbeta,5);
-		}	
-		
-		Color = Color * float4(F,1);	*/
-	//}
-}
-
-float4 NormalDistancePS( VertOut IN, uniform float refIndex):COLOR
-{
- 
- float4 Color = float4(0, 0, 0, 0);
- //return Color;
- Color = float4(normalize(IN.mNormal)/* * refIndex*/, length(IN.cPos));
- return Color;
-}
-
-
-float4 DistanceMinMaxPS( VertOut IN, uniform float refIndex):COLOR
-{
- 
- float4 Color = float4(0, 0, 0, 0);
- Color = float4(1.0/length(IN.cPos), length(IN.cPos),0,1);
- //return 1;
- return Color;
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_CauCube.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_CauCube.hlsl	(revision 1691)
+++ 	(revision )
@@ -1,91 +1,0 @@
-struct VS_OUT
-{
-	float4 hPosition	: POSITION;
-	float4 color		: COLOR0;	
-};
-
-VS_OUT CauVS(float4 position : POSITION,	
-		float4 texCoord : TEXCOORD0,
-		float4 color 	: COLOR0,
-		uniform float4x4 worldView,
-		uniform float4x4 Proj,
-		uniform float resolution,
-		uniform sampler2D PhotonHitMap : register(s0))
-{
-  VS_OUT OUT;
-     
-  float4 cPosition;
-  float pixel = 1.0 / 32.0;   
-  float2 uv = float2(position.x, 1.0 - position.y);
-  float4 pos = tex2Dlod(PhotonHitMap, float4(uv,0,0)).rgba;
-
-   if(pos.a == 0)//no photon hit
-   {
-		OUT.color = float4(0,0,0,0);		
-		OUT.hPosition = float4(0, 0, -1000000, 1);
-   }
-   else
-   {
-   		float4 wPosition = float4(normalize(pos.xyz),1);    
-		cPosition = mul(worldView, wPosition);
-		OUT.hPosition = mul(Proj, cPosition);
-		
-		float intensity = 0.25;
-		
-		//read four neighbours
-		float sumdist = 0;
-		float dist;
-		float valids = 0;
-		float4 pos1 = tex2Dlod(PhotonHitMap, float4(uv + float2(pixel, pixel),0,0));
-		if(pos1.a != 0)
-		{
-			dist = length(pos1.xyz - pos.xyz);
-			sumdist += dist;
-			valids++;
-		}			
-		
-		float4 pos2 = tex2Dlod(PhotonHitMap, float4(uv + float2(-pixel, pixel),0,0));
-		if(pos2.a != 0)
-		{
-			dist = length(pos2.xyz - pos.xyz);
-			sumdist += dist;
-			valids++;
-		}
-		
-		float4 pos3 = tex2Dlod(PhotonHitMap, float4(uv + float2(pixel, -pixel),0,0));
-		if(pos3.a != 0)
-		{
-			dist = length(pos3.xyz - pos.xyz);
-			sumdist += dist;
-			valids++;
-		}
-		
-		float4 pos4 = tex2Dlod(PhotonHitMap, float4(uv + float2(-pixel, -pixel),0,0));
-		if(pos4.a != 0)
-		{
-			dist = length(pos4.xyz - pos.xyz);
-			sumdist += dist;
-			valids++;
-		}
-		//if(valids == 0) sumdist = 100000;		
-		float avrdist = sumdist / valids;
-		//float maxdist = 10;
-		//intensity = max(maxdist - avrdist, 0.0) / maxdist;
-		intensity = 60.0 / (avrdist * avrdist * 3.14);
-		//intensity = valids / 4.0;//avrdist;
-		
-		//OUT.color = float4(1,1,1,intensity);
-		OUT.color = intensity;
-	}  
-   
-   return OUT;
-}
-
-
-float4 CauPS(VS_OUT IN,
-		uniform float3 color ):COLOR
-{ 
-  return IN.color * float4(color, 1);  
-}
-
-
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Cau.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Cau.hlsl	(revision 1487)
+++ 	(revision )
@@ -1,74 +1,0 @@
-float CauSpriteSize;
-float CauSpriteIntens;
-
-struct VS_OUT
-{
-	float4 hPosition	: POSITION;
-	float4 texCoord		: TEXCOORD0;
-	float4 color		: COLOR0;
-	float2 r			: TEXCOORD1;
-	float2 center		: TEXCOORD2;
-	float4 position		: TEXCOORD3;
-	float pSize			: PSIZE;
-	float dist			: TEXCOORD4;
-};
-
-VS_OUT CauVS(float4 position : POSITION,	
-		float4 texCoord : TEXCOORD0,
-		float4 color 	: COLOR0,
-		uniform float4x4 worldView,
-		uniform float4x4 Proj,
-		uniform float4x4 worldViewProj,
-		uniform float resolution,
-		uniform sampler2D PhotonHitMap : register(s0))
-{
-  VS_OUT OUT;
-     
-   float radius = CauSpriteSize;
-   OUT.pSize = radius;
-   float4 cPosition;  
-
-  float4 pos = tex2Dlod(PhotonHitMap, float4(position.x, 1.0 - position.y,0,0)).rgba;
-//	float4 pos = float4(0,0,-0.5,1);
-	
-   if(pos.a == 0)//no photon hit
-   {
-		OUT.center = 1000.0f;
-		OUT.position = OUT.hPosition = 1000.0f; //transform out of view
-   }
-   else
-   {
-   		float4 wPosition = float4(normalize(pos.xyz),1); 
-    
-		cPosition = mul(worldView, wPosition);
-		OUT.center = cPosition.xy;
-		OUT.position = cPosition;	
-		OUT.hPosition = mul(Proj, cPosition);		
-	 }	
-  
-   OUT.r.x = radius;
-   OUT.r.y = radius;
-   OUT.texCoord = texCoord;
-   OUT.color = 1; 
-   OUT.color = float4(pos);
-   OUT.dist = length(pos.xyz);
-   
-   return OUT;
-}
-
-
-float4 CauPS(VS_OUT IN,
-		uniform float3 color,
-		uniform sampler2D intensityTex : register(s1)
-		 ):COLOR
-{
-
- // float2 texcoord = (IN.center - IN.position.xy) / IN.r.x;
- // texcoord = (texcoord + 1.0) * 0.5;
-  IN.color.rgb = color;
-  float intens = tex2D(intensityTex, IN.texCoord).r;
-  IN.color.a = intens * CauSpriteIntens;
-  return IN.color;  
-}
-
-
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_PostProc.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_PostProc.hlsl	(revision 1955)
+++ 	(revision )
@@ -1,187 +1,0 @@
-struct VS_OUT
-{
-	float4 hPosition	: POSITION;
-	float2 texCoord		: TEXCOORD0;	
-};
-
-VS_OUT defaultVS(float4 position : POSITION,	
-				float4 texCoord : TEXCOORD0)
-{
-	VS_OUT OUT;
-  
-	OUT.hPosition = float4(sign(position.xy),0,1);
-	
-	OUT.texCoord = (float2(OUT.hPosition.x,
-							- OUT.hPosition.y) + 1.0) / 2.0;
-	
-   return OUT;
-}
-
-
-float4 defaultPS(VS_OUT IN,
-		uniform sampler2D Texture: register(s0)
-		 ):COLOR
-{	
-
-	/*float intens = length(tex2D(Texture,IN.texCoord ).rgb) / sqrt(3.0);
-	return float4(intens,intens,intens,1);*/
-	
-	float4 sample = tex2D(Texture,IN.texCoord );
-	if (sample.r + sample.g + sample.b < 1.7f) sample = float4(0,0,0,0);
-	return sample;
-	
-	//return tex2D(Texture,IN.texCoord ).b;
-}
-
-float4 BlackPS(VS_OUT IN):COLOR
-{
-	return float4(0,0,0,1);
-}
-
-float4 GlowCutPS(VS_OUT IN,
-		uniform float width,
-		uniform float height,
-		uniform float cutValue,
-		uniform float timeBlur,
-		uniform sampler2D Texture: register(s0)
-		,uniform sampler2D LastTexture: register(s1)
-		 ):COLOR
-{	
-
-	IN.texCoord += float2(0.5/width, 0.5/height);
-	float4 sample = 2.0 * tex2D(Texture,IN.texCoord );
-	float luminance = dot(sample.rgb, float3(1.0, 4.5907, 0.0601));
-	if (luminance < cutValue) sample = float4(0,0,0,0);
-	float alpha = timeBlur;
-	sample = sample * alpha + tex2D(LastTexture, IN.texCoord) * (1.0 - alpha);
-	
-	return sample;
-	return sample;
-}
-
-half4 LuminancePS(VS_OUT IN,
-		uniform half width,
-		uniform half height,
-		uniform sampler2D Texture: register(s0)
-		):COLOR
-{	
-
-	IN.texCoord += half2(0.5/width, 0.5/height);
-	half4 sample = tex2D(Texture,IN.texCoord );
-	
-	// D65 white conversion and weighting
-	half avg = sample.r * 0.21f + sample.g * 0.39f + sample.b * 0.4f;
-	return half4(avg, 0, 0, 1);
-}
-
-float4 GlowAddPS(VS_OUT IN,
-		uniform float width,
-		uniform float height,
-		uniform sampler2D Texture: register(s0),
-		uniform sampler2D GlowTexture: register(s1)
-		 ):COLOR
-{	
-	IN.texCoord += float2(0.5/width, 0.5/height);
-	//float intens = length(tex2D(Texture,IN.texCoord ).rgb) / sqrt(3.0);
-	//return float4(intens,intens,intens,1);
-	//return 1;
-	return tex2D(Texture,IN.texCoord ) + tex2D(GlowTexture,IN.texCoord );
-}
-
-float4 ToneMapPS(VS_OUT IN,
-		uniform half width,
-		uniform half height,
-		uniform half Gain,
-		uniform sampler2D Scene: register(s0),
-		uniform sampler2D AvrLuminanceTexture: register(s1),
-		uniform sampler2D LuminanceTexture: register(s2),
-		uniform sampler2D GlobalLuminanceTexture: register(s3)
-		 ):COLOR
-{	
-	IN.texCoord += half2(0.5/width, 0.5/height);
-	
-	float gLum = tex2D(GlobalLuminanceTexture, float2(0.5,0.5)).r;
-	gLum = max(gLum, 0.31415);
-	
-	// Automatic key calculation
-	//half Key = 1.03f - 2.0f / (2.0f + log10(tex2D(AvrLuminanceTexture, IN.texCoord).r + 1.0f));	
-	//half Key = 1 / (tex2D(AvrLuminanceTexture, IN.texCoord).r / 1 + tex2D(AvrLuminanceTexture, IN.texCoord).r);
-	//return 1 / Key;
-	// Relative luminance
-	//half RelLum =  Key* tex2D(LuminanceTexture, IN.texCoord).r / 
-	//					  tex2D(AvrLuminanceTexture, IN.texCoord).r;
-	half Key = 1.03f - 2.0f / (2.0f + log10(gLum + 1.0f));	
-	half RelLum =  Key* tex2D(LuminanceTexture, IN.texCoord).r / gLum;
-	half Lum = RelLum / (1 + RelLum);
-	// Color weghting
-	half4 Color = tex2D(Scene, IN.texCoord) /  gLum * 0.4f;
-	// Gamma correction
-	
-	//Color = pow(Color * half4(1.05f, 0.97f, 1.27f, 1.0f), Gain);
-	//return Color;
-	return float4(tex2D(GlobalLuminanceTexture, IN.texCoord).r,
-				  tex2D(GlobalLuminanceTexture, IN.texCoord).r,
-				  tex2D(GlobalLuminanceTexture, IN.texCoord).r,
-				  1);
-
-}
-
-float4 GlowBlurHPS(VS_OUT IN,
-		uniform float Stretch,
-		uniform float width,
-		uniform float height,
-		uniform float timeBlur,
-		uniform sampler2D Texture: register(s0)) : COLOR {
-	float2 tex0 = IN.texCoord + float2(0.5/width, 0.5/height);
-	float4 texLookUp_h;
-			
-	/*texLookUp_h =	 tex2D(Texture, float2(tex0.x-(3.86979f*Stretch/width), tex0.y)) +
-					 tex2D(Texture, float2(tex0.x-(1.72291f*Stretch/width ), tex0.y)) +
-					 tex2D(Texture, tex0) +
-					 tex2D(Texture, float2(tex0.x+(1.72291f*Stretch/width), tex0.y)) +
-					 tex2D(Texture, float2(tex0.x+(3.86979f*Stretch/width), tex0.y));*/
-	
-	texLookUp_h =	 tex2D(Texture, float2(tex0.x-(2.0*Stretch/width), tex0.y)) +
-					 tex2D(Texture, float2(tex0.x-(1.0*Stretch/width ), tex0.y)) +
-					 tex2D(Texture, tex0) +
-					 tex2D(Texture, float2(tex0.x+(1.0*Stretch/width), tex0.y)) +
-					 tex2D(Texture, float2(tex0.x+(2.0*Stretch/width), tex0.y));
-
-	return float4(texLookUp_h.rgb / 5.0, timeBlur) ;
-	//return texLookUp_h /5;
-}
-
-float4 GlowBlurVPS(VS_OUT IN,
-		uniform float Stretch,
-		uniform float width,
-		uniform float height,
-		uniform float timeBlur,
-		uniform sampler2D Texture: register(s0)) : COLOR {
-	float2 tex0 = IN.texCoord + float2(0.5/width, 0.5/height);
-	float4 texLookUp_v;
-		
-	/*texLookUp_v =    tex2D(Texture, float2(tex0.x, tex0.y-(3.86979f*Stretch/height)))+
-					 tex2D(Texture, float2(tex0.x, tex0.y-(1.72291f*Stretch/height)))+
-					 tex2D(Texture, tex0)+
-					 tex2D(Texture, float2(tex0.x, tex0.y+(1.72291f*Stretch/height)))+
-					 tex2D(Texture, float2(tex0.x, tex0.y+(3.86979f*Stretch/height)));*/
-
-	texLookUp_v =    tex2D(Texture, float2(tex0.x, tex0.y-(2*Stretch/height)))+
-					 tex2D(Texture, float2(tex0.x, tex0.y-(1*Stretch/height)))+
-					 tex2D(Texture, tex0) +
-					 tex2D(Texture, float2(tex0.x, tex0.y+(1*Stretch/height)))+
-					 tex2D(Texture, float2(tex0.x, tex0.y+(2*Stretch/height)));
-	
-	return float4(texLookUp_v.rgb / 5.0, timeBlur);
-}
-
-float4 CopyPS(VS_OUT IN,
-		uniform float width,
-		uniform float height,
-		uniform sampler2D Texture: register(s0)) : COLOR 
-		{
-	IN.texCoord += float2(0.5/width, 0.5/height);
-	return tex2D(Texture,IN.texCoord );
-}
-
-
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl	(revision 2181)
+++ 	(revision )
@@ -1,247 +1,0 @@
-///////depth map
-struct VS_OUT
-{
-	float4 hPosition	: POSITION;
-	float4 Position		: TEXCOORD0;	
-};
-
-VS_OUT DepthVS(float4 position : POSITION,	
-				uniform float4x4 worldViewProj)
-{
-  
-  VS_OUT OUT;
- 
-  OUT.hPosition = mul(worldViewProj, position);
-  OUT.Position = mul(worldViewProj, position);
-  
-  return OUT;
-}
-
-//for directional light
-float4 DepthPS(VS_OUT IN ):COLOR
-{
-//return 1;
-	float4 pos = (IN.Position / IN.Position.w);
-	//pos = (pos +1.0 ) / 2.0;
-	return float4(pos.z, pos.z * pos.z, 1, 1);	
-}
-
-VS_OUT DepthDistVS(float4 position : POSITION,	
-				uniform float4x4 worldViewProj,
-				uniform float4x4 worldView)
-{
-  
-  VS_OUT OUT;
- 
-  OUT.hPosition = mul(worldViewProj, position);
-  OUT.Position = mul(worldView, position);
-  
-  return OUT;
-}
-
-float4 DepthDistPS(VS_OUT IN,
-					uniform float farPlane ):COLOR
-{
-	float dist = length(IN.Position.xyz) / farPlane;
-	return float4(dist, dist * dist, 1, 1);	
-	//return farPlane;
-}
-
-///////////////Shadow
-
-struct VS_OUT_SHADOW
-{
-	float4 hPosition	: POSITION;
-	float4 lPosition	: TEXCOORD0;
-	float4 lVPosition	: TEXCOORD1;
-};
-
-VS_OUT_SHADOW depthShadowVS(float4 position : POSITION,	
-							uniform float4x4 worldViewProj,
-							uniform float4x4 world,
-							uniform float4x4 lightViewProj)
-{
-  VS_OUT_SHADOW OUT;
-  OUT.hPosition = mul(worldViewProj, position);
-  float4 wPos = mul(world, position);
-  OUT.lPosition = mul(lightViewProj, wPos);  
-  OUT.lVPosition = 0;
-  return OUT;
-}
-
-/*
-float4 depthShadowPS(VS_OUT_SHADOW IN,
-					uniform float4x4 lightViewProj,
-					uniform sampler2D depthShadowMap : register(s0)
-					):COLOR
-{	
-	float bias = 0.001;
-	float4 light = float4(1,1,1,1);
-	float4 shadow = float4(0.25,0.25,0.25,1);
-	//float4 shadow = float4(0,0,0,1);
-	
-	if(IN.lPosition.z > 0.0)
-	{
-		float4 pos = (IN.lPosition / IN.lPosition.w);
-		
-		if(length(pos.xy)>1)		
-			light = shadow;
-		else
-		{
-			pos.xy = (pos.xy + 1.0) / 2.0;
-			pos.y = 1.0 - pos.y;
-			float4 storedDepth = tex2D(depthShadowMap, pos.xy);
-	
-			 
-			float M1 = storedDepth.r;
-			float M2 = storedDepth.g;
-			float v2 = M2 - M1 * M1;
-			float pmax = v2 / (v2 + pow(M1 - pos.z, 2));
-			light = saturate(shadow + (1 - shadow) * pmax);
-			
-		}
-		
-	}
-	else
-		light = shadow;	
-	
-	return light;	
-}
-*/
-
-
-
-VS_OUT_SHADOW distShadowVS(float4 position : POSITION,	
-							uniform float4x4 worldViewProj,
-							uniform float4x4 world,
-							uniform float4x4 lightView,
-							uniform float4x4 lightViewProj)
-{
-  VS_OUT_SHADOW OUT;
-  OUT.hPosition = mul(worldViewProj, position);
-  float4 wPos = mul(world, position);
-  OUT.lPosition = mul(lightViewProj, wPos);
-  OUT.lVPosition = mul(lightView, wPos);  
-  return OUT;
-}
-
-
-float4 distShadowPS(VS_OUT_SHADOW IN,
-					uniform float4x4 lightViewProj,
-					uniform float lightFarPlane,
-					uniform sampler2D depthShadowMap : register(s0)
-					):COLOR
-{	
-	float bias = 0.001;
-	float epsilon = 0.001;
-	float4 light = float4(1,1,1,1);
-	float4 shadow = float4(0.85,0.85,0.85,1);
-	
-	if(IN.lPosition.z > 0.0)
-	{
-		float4 pos = (IN.lPosition / IN.lPosition.w);
-		
-		float d = length(pos.xy);
-			
-		light = saturate((1.0 - d)/0.05);
-		
-		if(d <= 1.0)
-		{
-			float dist = length(IN.lVPosition.xyz) / lightFarPlane;
-			pos.xy = (pos.xy + 1.0) / 2.0;
-			pos.y = 1.0 - pos.y;
-			float4 storedDist = tex2D(depthShadowMap, pos.xy);
-			dist -= bias;
-			float lit_factor = light * (dist <= storedDist.r);	
-    	 
-			float M1 = storedDist.r;
-			float M2 = storedDist.g;
-			float v2 = min(max(M2 - M1 * M1, 0.0) +  epsilon, 1.0);
-			float m_d = M1 - dist;
-    		float pmax = v2 / (v2 + m_d * m_d);
-						
-    		// Adjust the light color based on the shadow attenuation
-    		light = max(lit_factor, pmax);
-    	
-		}
-		
-	}
-	else
-		light = 0;	
-	
-	return shadow + (1 - shadow) * light;
-}
-/*
-float4 distShadowPS(VS_OUT_SHADOW IN,
-					uniform float4x4 lightViewProj,
-					uniform float lightFarPlane,
-					uniform sampler2D depthShadowMap : register(s0)
-					):COLOR
-{	
-	float bias = 0.001;
-	float epsilon = 0.001;
-	float4 light = float4(1,1,1,1);
-	float4 shadow = float4(0.65,0.65,0.65,1);
-	
-	if(IN.lPosition.z > 0.0)
-	{
-		float4 pos = (IN.lPosition / IN.lPosition.w);
-		
-		float d = length(pos.xy);
-			
-		light = saturate((1.0 - d)/0.05);
-		
-		if(d <= 1.0)
-		{
-			float dist = length(IN.lVPosition.xyz) / lightFarPlane;
-			pos.xy = (pos.xy + 1.0) / 2.0;
-			pos.y = 1.0 - pos.y;
-			float4 storedDist = tex2D(depthShadowMap, pos.xy);
-			
-    		light = storedDist.r + dist*0.000000000001;
-    	
-		}
-		
-	}
-	else
-		light = 0;	
-	
-	return shadow + (1 - shadow) * light;
-}
-*/
-
-float4 depthShadowPS(VS_OUT_SHADOW IN,
-					uniform float4x4 lightViewProj,
-					uniform sampler2D depthShadowMap : register(s0)
-					):COLOR
-{	
-	float bias = 0.0001;
-	float4 light = float4(1,1,1,1);
-	float4 shadow = float4(0.95,0.95,0.95,1);
-	//float4 shadow = float4(0,0,0,1);
-	
-	if(IN.lPosition.z > 0.0)
-	{
-		float4 pos = (IN.lPosition / IN.lPosition.w);
-		
-		if(length(pos.xy)>1)		
-			light = shadow;
-		else
-		{
-			pos.xy = (pos.xy + 1.0) / 2.0;
-			pos.y = 1.0 - pos.y;
-			float4 storedDepth = tex2D(depthShadowMap, pos.xy);
-	
-			if(storedDepth.r + bias < pos.z)
-			{
-				light = shadow;
-			}
-		}
-		
-	}
-	else
-		light = shadow;
-	
-	
-	return light;	
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Localized_EnvMap.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Localized_EnvMap.hlsl	(revision 1724)
+++ 	(revision )
@@ -1,502 +1,0 @@
-//metal:
-float3 n, k;	// R 700 nm, G 550 nm, B 435 nm 
-float REDUCED_CUBEMAP_SIZE = 4;
-
-float3 F0;
-/*
-	
-	if (iWhichMetal == 1) { // copper	
-		n = float3(0.21f, 0.96f, 1.17f);	
-		k = float3(4.16f, 2.57f, 2.32f); }
-	else if (iWhichMetal == 2) { // gold
-		n = float3(0.16f, 0.35f, 1.6f);		
-		k = float3(3.98f, 2.71f, 1.92f); }
-	else if (iWhichMetal == 3) { // silver
-		n = float3(0.142f, 0.124f, 0.158f);	
-		k = float3(4.52f,  3.33f, 2.32f); }
-	else if (iWhichMetal == 4) { // alu
-		n = float3(1.83f, 0.96f, 0.577f);
-		k = float3(8.31f,  6.69f, 5.288f); }
-
-*/	
-
-float4 readCubeMap(samplerCUBE cm, float3 coord)		
-{
-	float4 color = texCUBE( cm, float3(coord.xy, - coord.z) );
-	color.a = 1;
-	return color;
-}
-
-float readDistanceCubeMap(samplerCUBE dcm, float3 coord)		
-{
-	float dist = texCUBE(dcm, float3(coord.xy, - coord.z)).r;
-	if(dist == 0) dist = 1000; ///sky
-	return dist;
-}
-
-
-
-#define LIN_ITERATIONCOUNT 6
-#define LIN_ITERATIONCOUNT_L0 5
-#define LIN_ITERATIONCOUNT_L1 5
-#define LIN_ITERATIONCOUNT_L2 3
-#define LIN_ITERATIONCOUNT_L3 1
-#define SECANT_ITERATIONCOUNT 2
-
-float3 Hit(float3 x, float3 R, samplerCUBE mp, float cameraDistance = 0)
-{
-	return R + 0.000000001 *x;
-	R = normalize(R);
-	
-	float3 Ra = abs(R);
-	float3 xa = abs(x);
-	float a = max(max(xa.x,xa.y),xa.z) / 
-			  max(max(Ra.x,Ra.y),Ra.z);
-	
-	bool overshoot = false, undershoot = false;
-	float dp, dl = 0, ppp, llp;
-	float lR = readDistanceCubeMap(mp, R);
-	float3 p = R;
-	
-	/*
-	if(cameraDistance < 100)
-		LIN_ITERATIONCOUNT  = (float) LIN_ITERATIONCOUNT_L0;
-	else if(cameraDistance < 200)
-		LIN_ITERATIONCOUNT  = (float) LIN_ITERATIONCOUNT_L1;
-	else if(cameraDistance < 300)
-		LIN_ITERATIONCOUNT  = (float) LIN_ITERATIONCOUNT_L2;
-	else
-		LIN_ITERATIONCOUNT  = (float) LIN_ITERATIONCOUNT_L3;
-	*/
-	
-	float dt = 1.0 / LIN_ITERATIONCOUNT;
-	
-	//linear iteration	
-	float t = 0;
-	while(t < 1.0 && !overshoot)
-	{
-		//if(!overshoot)
-		//{
-			dp = a * t / (1 - t);
-			p = x + R * dp;
-			float dist = readDistanceCubeMap(mp, p);
-			if(dist > 0)
-			{
-				ppp = length(p) / dist;
-				if(ppp < 1)
-				{
-					dl = dp;
-					llp = ppp;		
-					undershoot = true;		
-				}
-				else
-				{
-					if (undershoot) 
-					   overshoot = true;
-				}
-			}
-			else 
-				undershoot = false;
-		//}
-		t += dt;		
-	}
-	
-	if(overshoot)
-	{
-		float dnew;
-		for(int i = 0; i < SECANT_ITERATIONCOUNT; i++ )
-		{
-			dnew = dl + (dp - dl) * (1 - llp) / (ppp - llp);	
-			    
-			p = x + R * dnew;
-			half pppnew = length(p) / readDistanceCubeMap(mp, p);
-			if(pppnew < 1)
-			{
-				llp = pppnew;
-				dl = dnew;
-			}
-			else
-			{
-				ppp = pppnew;
-				dp = dnew;
-			}
-		}	
-	}
-	else
-		p = float3(0,0,0);
-	 
-	return p;
-}
-/*			
-
-float3 Hit( float3 x, float3 R, samplerCUBE mp )
-{
-	//return R  + 0.00000000001 * x;
-	float rl = readDistanceCubeMap( mp, R);				// |r|
-	
-	float ppp = length( x ) /  readDistanceCubeMap( mp, x);			// |p|/|p|
-	float dun = 0, pun = ppp, dov = 0, pov = 0;
-	float dl = rl * ( 1 - ppp );							// eq. 2
-	float3 l = x + R * dl;									// ray equation
-
-	// iteration
-	for( int i = 0; i < 2; i++ )	// 2 !!!!!!!!!!!!!!!!!!!!!!!
-	{
-		float llp = length( l ) / readDistanceCubeMap( mp, l);		// |l|/|l|
-		if ( llp < 0.999f )									// undershooting
-		{
-			dun = dl; pun = llp;							// last undershooting
-			dl += ( dov == 0 ) ? rl * ( 1 - llp ) :			// eq. 2
-				( dl - dov ) * ( 1 - llp ) / ( llp - pov );	// eq. 3
-		} else if ( llp > 1.001f )							// overshooting
-		{
-			dov = dl; pov = llp;							// last overshooting
-			dl += ( dl -dun ) * ( 1 - llp ) / ( llp - pun );// eq. 3
-		}
-		l = x + R * dl;										// ray equation
-	}
-	return l;												// computed hit point
-}
-*/
-
-/*
-float3 Hit( float3 x, float3 R, samplerCUBE mp )
-{
-	float rl = readDistanceCubeMap( mp, R);				// |r|
-	
-	float ppp = length( x ) /  readDistanceCubeMap( mp, x);			// |p|/|p|
-	float dun = 0, pun = ppp, dov = 0, pov = 0;
-	float dl = rl * ( 1 - ppp );							// eq. 2
-	float3 l = x + R * dl;									// ray equation
-
-	// iteration
-	for( int i = 0; i < SECANT_ITERATIONCOUNT; i++ )
-	{
-		float llp = length( l ) / readDistanceCubeMap( mp, l);		// |l|/|l|
-		if ( llp < 0.999f )									// undershooting
-		{
-			dun = dl; pun = llp;							// last undershooting
-			dl += ( dov == 0 ) ? rl * ( 1 - llp ) :			// eq. 2
-				( dl - dov ) * ( 1 - llp ) / ( llp - pov );	// eq. 3
-		} else if ( llp > 1.001f )							// overshooting
-		{
-			dov = dl; pov = llp;							// last overshooting
-			dl += ( dl -dun ) * ( 1 - llp ) / ( llp - pun );// eq. 3
-		}
-		l = x + R * dl;										// ray equation
-	}
-	return l;												// computed hit point
-}
-*/
-
-void LocalizedVS(float4 position : POSITION,
-		out float3 wPos	: TEXCOORD1,				
-		float2 texCoord : TEXCOORD0,
-		out float2 otexCoord : TEXCOORD0,
-		float3 normal   : NORMAL,
-		out float3 mNormal  : TEXCOORD2,
-		out float4 hPos : POSITION,		
-		uniform float4x4 worldViewProj,
-		uniform float4x4 world,
-		uniform float4x4 worldI
-		)
-{
- 
-  hPos = mul(worldViewProj, position);
-  wPos = mul(world, position).xyz;  
-  mNormal = mul(normal, worldI);  
-  otexCoord = texCoord;
-}
-//////////////
-//Localized reflection
-//////////////
-void LocalizedPS(  float2 texCoord : TEXCOORD0, 
-		float3 wPos	: TEXCOORD1,	
-		float3 mNormal  : TEXCOORD2,
-		uniform float3 cameraPos,
-		uniform samplerCUBE CubeMap : register(s0),
-		uniform samplerCUBE DistanceMap : register(s1),
-		uniform float3 lastCenter,
-		uniform float3 lightPosition,		
-		out float4 Color :COLOR0)
-{
-	
-	Color = float4(1,1,1,1);
-	
-	mNormal = normalize(mNormal);
-	float3 RR, TT;	
-	float3 mPos = wPos - lastCenter;
-	float3 V = normalize(wPos - cameraPos);
-	float3 R = /*normalize*/(reflect( V, mNormal));
-	
-	float3 T = refract(V, mNormal, 0.9);
-		
-	RR = R;	TT = T;
-	//RR += 0.000001 * lastCenter.x;
-	RR = Hit(mPos, R, DistanceMap);
-	TT = Hit(mPos, T, DistanceMap);
-	
-	float4 reflectcolor = readCubeMap(CubeMap, RR );		
-	float4 refractcolor = readCubeMap(CubeMap, TT );		
-	
-	float cos_theta = -dot(V, mNormal);
-	float sFresnel = 0.1;
-	float F = (sFresnel + pow(1-cos_theta, 5.0f) * (1-sFresnel));
-    
-    float3 L = normalize(lightPosition - wPos);
-	float3 H = normalize(L+V);
-	float4 lighting = lit(dot(mNormal, L),dot(mNormal, H), 30);
-	Color = (F * reflectcolor + (1-F) * refractcolor) + lighting.z;	
-}
-
-
-
-//////////////
-//Metal
-//////////////
-void LocalizedMetalPS(  float2 texCoord : TEXCOORD0, 
-		float3 wPos	: TEXCOORD1,	
-		float3 mNormal  : TEXCOORD2,
-		uniform float3 cameraPos,
-		uniform samplerCUBE CubeMap : register(s0),
-		uniform samplerCUBE DistanceMap : register(s1),
-		uniform float3 lastCenter,
-		uniform float3 lightPosition,				
-		out float4 Color :COLOR0)
-{
-	
-	Color = float4(1,1,1,1);
-	
-	mNormal = normalize(mNormal);
-	float3 newTexCoord;	
-	float3 mPos = wPos - lastCenter;
-	float3 V  = (wPos - cameraPos);
-	float cameraDistace = length(V);
-	V = normalize(V);
-	float3 R = normalize(reflect( V, mNormal));
-		
-	newTexCoord = R;	
-	
-	newTexCoord = Hit(mPos, R, DistanceMap);
-	/*if(dot(newTexCoord,newTexCoord) == 0) 
-		Color = float4(0.5,0.5,0.5,1);
-	else*/
-	Color = readCubeMap(CubeMap, newTexCoord );	
-	
-	float ctheta_in = dot(mNormal,R);
-	float ctheta_out = dot(mNormal,-V);
-
-	float3 F = 0;
-	
-	// F,P,G számítása
-	if ( ctheta_in > 0 && ctheta_out > 0 )
-	{
-		float3 H = normalize(R - V);	// felezõvektor
-		float cbeta  = dot(H,R);		
-		//F = ( (n-1)*(n-1) + pow(1-cbeta,5) * 4*n + k*k) / ( (n+1)*(n+1) + k*k );
-		//float3 F0 = ((n-1)*(n-1) + k*k) / ( (n+1)*(n+1) + k*k );
-		//float3 F1 = float3(1.0f,1.0f,1.0f) - F0;
-		F = F0 + (1-F0)*pow(1-cbeta,5);
-	}	
-	
-	Color = Color * float4(F,1);	
-}
-//////////////
-//PhotonMap
-//////////////
-/*void PhotonMapPS(  float2 texCoord : TEXCOORD0, 
-		float3 wPos	: TEXCOORD1,	
-		float3 mNormal  : TEXCOORD2,
-		uniform float3 cameraPos,
-		uniform samplerCUBE UVMap : register(s0),
-		uniform samplerCUBE DistanceMap : register(s1),
-		uniform float3 lastCenter,
-		out float4 Color :COLOR0)
-{
-	
-	Color = float4(1,1,1,1);
-	
-	mNormal = normalize(mNormal);
-	float3 newTexCoord;	
-	float3 mPos = wPos - lastCenter;
-	float3 V = normalize(wPos - cameraPos);
-	float3 R = normalize(reflect( V, mNormal));
-		
-	newTexCoord = R;	
-	
-	newTexCoord = Hit(mPos, R, DistanceMap);
-	
-	Color = readCubeMap(UVMap, newTexCoord );
-	//Color = float4(1,0,0,1);		
-}*/
-
-float4 PhotonMapCausticPS(  float2 texCoord : TEXCOORD0, 
-		float3 wPos	: TEXCOORD1,	
-		float3 mNormal  : TEXCOORD2,
-		uniform float3 cameraPos,
-		uniform samplerCUBE DistanceMap : register(s0),
-		uniform float3 lastCenter):COLOR0
-{
-	
-	float4 Color = float4(1,1,1,1);
-	
-	mNormal = normalize(mNormal);
-	float3 newTexCoord;	
-	float3 mPos = wPos - lastCenter;
-	float3 V = normalize(wPos - cameraPos);
-		
-	float3 R = refract(V, mNormal, 0.85);		
-	//float3 R = V;	
-	newTexCoord = R;	
-		
-	newTexCoord = Hit(mPos, R, DistanceMap);
-		
-	Color = float4(newTexCoord, 1);
-	
-	//Color = 0.0001 * Color +  float4(0,0,1,1);
-	//Color += 0.0001 * lastCenter.x;
-	if(dot(V,mNormal)>0)
-	{
-		Color = float4(1,0,0,0);		
-	}		
-	return Color;
-}
-
-
-
-/////////////////////
-///// Diffuse
-///////////////////
-
-float4 GetContibution(float3 L, float3 pos, float3 N, float3 V, samplerCUBE SmallEnvMapSampler, samplerCUBE DistanceEnvMapSampler)	// Phong-Blinn
-// L: a hossza lényeges (az egységkocka faláig ér)
-{
-    REDUCED_CUBEMAP_SIZE = 4;
-    
-	float kd = 0.3;	// 0.3
-	float ks = 0;	// 0.5
-	float shininess = 10;
-	
-	float l = length(L);
-	L = normalize(L);
-
-	//dw
-	float dw = 4 / (REDUCED_CUBEMAP_SIZE*REDUCED_CUBEMAP_SIZE*l*l*l + 4/3.1416f);
-	//Lin
-	float4 Lin = readCubeMap(SmallEnvMapSampler, L);
-	//r
-	float doy = readDistanceCubeMap(DistanceEnvMapSampler, L);
-	float dxy = length(L * doy - pos);	
-
-	//dws
-	float dws = (doy*doy * dw) / (dxy*dxy*(1 - dw/3.1416f) + doy*doy*dw/3.1416f);	// localization:
-	//float dws = dw;
-	
-	//L = L * doy - pos;	// L: x->y, az objektumtól induljon, ne a középpontból
-	L = normalize(L);
-	float3 H = normalize(L + V);	// felezõvektor
-
-	float a = kd * max(dot(N,L),0) + 
-			  ks * pow(max(dot(N,H),0), shininess); // diffuse + specular
-
-	// 1.: eddigi
-	//return Lin * a * dws;
-	
-	float ctheta_in = dot(N,L);
-	float ctheta_out = dot(N,V);	
-	
-	return Lin * a * dws;		
-}
-
-void DiffuseVS( float4 position : POSITION,
-                float3 normal : NORMAL,
-                float2 Tex : TEXCOORD0,
-                uniform float4x4 worldViewProj,
-				uniform float4x4 world,
-				//uniform float3 lastCenter,	//LI//
-				out float4 hposition : POSITION,
-                out float2 oTex : TEXCOORD0,
-                out float3 Normal : TEXCOORD1,
-                out float3 pos : TEXCOORD2 )
-{
-	pos = /*lastCenter + 0.01 * */mul( world, position ).xyz;
-	Normal = normal;
-    oTex = Tex;    
-    hposition = mul( worldViewProj, position );
-}
-
-
-float4 DiffusePS( float2 Tex : TEXCOORD0,
-           float3 N : TEXCOORD1,
-           float3 pos : TEXCOORD2,
-           uniform float3 cameraPos,
-           uniform float3 lastCenter,	//LI//
-           uniform samplerCUBE SmallEnvMapSampler : register(s0),
-           uniform samplerCUBE DistanceEnvMapSampler : register(s1)
-            ) : COLOR0
-{
-    REDUCED_CUBEMAP_SIZE = 4;
-	
-    //V = /*-*/normalize( V );
-    float3 V = normalize(pos - cameraPos);	// 
-    N = normalize( N ); 
-	float3 R = reflect(V, N);
-    pos -= lastCenter;
-
-	
-    //return float4(N,1);
-    //return float4(V,1);
-    //return float4(R,1);
-		
-	//return readCubeMap(SmallEnvMapSampler,R);
-	
-    //pos.xy += float2(1.0/LIGHT_TEXTURE_SIZE, -1.0/LIGHT_TEXTURE_SIZE);	// eltolás a pixel/texel középpontba
-    // x, y = -1..1
-    // z = 1
-    
-    float4 intens = 0;
-    /*
-	intens += GetContibution( R, pos, N, V, SmallEnvMapSampler);
-	intens = readCubeMap(SmallEnvMapSampler, R);
-	return intens;*/
-	
-	for (int x = 0; x < REDUCED_CUBEMAP_SIZE; x++)			// az envmap minden texelére
-	 for (int y = 0; y < REDUCED_CUBEMAP_SIZE; y++)
-	//int x = 0;		// az envmap 1 texelére
-	//int y = 0; 
-	//if (x==LIGHT_TEXTURE_SIZE/2 && y==LIGHT_TEXTURE_SIZE/2)
-	 {
-		// intenzitás kiolvasása az adott texelbõl 
-		
-		float2 p, tpos; 
-	    tpos.x = x/(float)REDUCED_CUBEMAP_SIZE;	// 0..1
-	    tpos.y = y/(float)REDUCED_CUBEMAP_SIZE;	// 0..1
-	    tpos.xy += float2(0.5/REDUCED_CUBEMAP_SIZE, 0.5/REDUCED_CUBEMAP_SIZE);	// az adott texel középpont uv koordinátái
-	    
-	    p.x = tpos.x; 
-	    p.y = 1-tpos.y;
-	    p.xy = 2*p.xy - 1;	// -1..1	// az adott texel középpont pozíciója
-	    
-	    float3 L;
-	   
-		L = float3(p.x, p.y, 1);
-		intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler);
-		
-		L = float3(p.x, p.y, -1);
-		intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler);
-		
-		L = float3(p.x, 1, p.y);
-		intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler);
-		
-		L = float3(p.x, -1, p.y);
-		intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler);
-		
-		L = float3(1, p.x, p.y);
-		intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler);
-		
-		L = float3(-1, p.x, p.y);
-		intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler);
-	}
-
-	return intens;
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapotNew.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapotNew.hlsl	(revision 2054)
+++ 	(revision )
@@ -1,488 +1,0 @@
-float3 F0;
-
-float4 readCubeMap(samplerCUBE cm, float3 coord)		
-{
-	float4 color = texCUBElod( cm, float4(coord.xy, - coord.z,0) );
-	return color;
-}
-
-float readDistanceCubeMap(samplerCUBE dcm, float3 coord)		
-{
-	float dist = texCUBElod(dcm, float4(coord.xy, - coord.z,0)).a;
-	return dist;
-}
-
-#define MAX_LIN_ITERATIONCOUNT 30  //80
-#define MIN_LIN_ITERATIONCOUNT 25  //60
-#define SECANT_ITERATIONCOUNT 1
-#define MAX_RAY_DEPTH 2
-
-/*
-void linearSearch(  float3 x, float3 R, float3 N, samplerCUBE mp,
-                    out float3 p,
-                    out float dl,
-                    out float dp,
-                    out float llp,
-                    out float ppp)
-{
- float3 Ra = abs(R), xa = abs(x);
- float xm =  max(max(xa.x,xa.y),xa.z);
- float Rm = max(max(Ra.x,Ra.y),Ra.z);
- float a = xm / Rm;
-           
- bool undershoot = false, overshoot = false; 
- 
- float dt =  length(x / xm - R / Rm) * MAX_LIN_ITERATIONCOUNT;
- dt = max(dt, MIN_LIN_ITERATIONCOUNT);
- dt = 1.0 / dt;
-    
- float t = 0.01;//dt;
- float pa;
- bool first = true;
- //Linear iteration
- while(t <= 1.0 && !overshoot)
- {
-   dp = a * t / (1 - t);
-   p = x + R * dp;
-   pa = readDistanceCubeMap(mp, p);
-   if(pa > 0)
-   {
-    ppp = length(p) / pa;
-    if(ppp < 1)
-    {
-      dl = dp;
-      llp = ppp;
-      undershoot = true;
-    }
-    else if(undershoot)
-      overshoot = true;
-   }
-   else
-     undershoot = false;
-   t += dt;  
- }
-
- if(!overshoot)
-  p = float3(0,0,0);
-}
-*/
-
-
-void linearSearch(  float3 x, float3 R, float3 N, samplerCUBE mp,
-					float2 minMax,					
-                    out float3 p,
-                    out float dl,
-                    out float dp,
-                    out float llp,
-                    out float ppp)
-{
- 
- int shootL = 0, shootP = 0;          
- bool found = false; 
- 
- float min = minMax.x;
- float max = minMax.y;
- 
- float minT = 0;
- float maxT = 0;
- {
-  	float a = dot(R,R);
-	float b = 2 * dot(R, x);
-	float c = dot(x,x) - min * min; 
-	float c2 = dot(x,x) - max * max; 
-	
-	float dis = b*b - 4*a*c;
-	float dis2 = b*b - 4*a*c2;
-	
-	float t1 = (-b + sqrt(dis))/ 2.0 * a;
-	float t2 = (-b - sqrt(dis))/ 2.0 * a;
-    float t3 = (-b + sqrt(dis2))/ 2.0 * a;
-	float t4 = (-b - sqrt(dis2))/ 2.0 * a;
-	
-	int numvalids = 0;
-	if(t1 > 0)
-	{
-	 numvalids++;
-	 if(t1 > maxT)maxT = t1;
-	 if(t1 < minT || minT == 0)minT = t1;
-	}
-	if(t2 > 0)
-	{
-	 numvalids++;
-	 if(t2 > maxT)maxT = t2;
-	 if(t2 < minT || minT == 0)minT = t2;
-	}
-	if(t3 > 0)
-	{
-	 numvalids++;
-	 if(t3 > maxT)maxT = t3;
-	 if(t3 < minT || minT == 0)minT = t3;
-	}
-	if(t4 > 0)
-	{
-	 numvalids++;
-	 if(t4 > maxT)maxT = t4;
-	 if(t4 < minT || minT == 0)minT = t4;
-	}
-	
-	if(numvalids % 2 == 1)
-	 minT = 0.01;
-	if(numvalids == 0)
-	 minT = maxT + 1.0;	
- }
- 
- int iterationNeeded = MIN_LIN_ITERATIONCOUNT;// + (dot(normalize(x), R) + 1.0) / 2.0 * (MAX_LIN_ITERATIONCOUNT - MIN_LIN_ITERATIONCOUNT);
- float pa;
- float dt = (maxT - minT) / (float) iterationNeeded ;
- dp = minT;
- //Linear iteration
- while(dp <= maxT && !found)
- {
-   p = x + R * dp;
-   pa = readDistanceCubeMap(mp, p);
-      
-   if(pa > 0)
-   {
-    ppp = length(p) / pa;
-    if(ppp < 1)
-      shootP = -1;
-    else 
-      shootP = 1;      
-    if(shootL * shootP == -1)
-      found = true;
-    else
-    {
-      shootL = shootP;
-      dl = dp;
-      llp = ppp;
-    }
-   }
-   else
-     shootL = 0;
-      
-   dp += dt;  
- }
-
- if(!found)
-  p = float3(0,0,0);
-}
-
-
-void secantSearch(float3 x, float3 R, samplerCUBE mp, 
-	               float dl,
-	               float dp,
-	               float llp,
-	               float ppp,
-	               out float3 p)
-{
-  for(int i= 0; i < SECANT_ITERATIONCOUNT; i++)
-  {
-   float dnew;
-   dnew = dl + (dp - dl) * (1 - llp) / (ppp - llp);
-   p = x + R * dnew;
-   half pppnew = length(p) / readDistanceCubeMap(mp, p);
-   if(pppnew < 1)
-   {
-    llp = pppnew;
-    dl = dnew;
-   }
-   else
-   {
-    ppp = pppnew;
-    dp = dnew;
-   }
-  }
-}
-
-float3 Hit(float3 x, float3 R, float3 N, 
-           samplerCUBE mp1,
-           samplerCUBE mp2,
-           samplerCUBE mp3Color,
-           samplerCUBE mp3Dist,
-           float2 minMax,
-           float2 minMax1,
-		   float2 minMax2,		   
-           out float4 Il, out float3 Nl)
-{
- float dl1 = 0, dp1, llp1, ppp1;
- float3 p1;
- linearSearch(x, R, N, mp1, minMax1, p1, dl1, dp1, llp1, ppp1);
- float dl2 = 0, dp2, llp2, ppp2;
- float3 p2;
- linearSearch(x, R, N, mp2, minMax2, p2, dl2, dp2, llp2, ppp2);
- 
- bool valid1 = dot(p1,p1) != 0;
- bool valid2 = dot(p2,p2) != 0;
-		
- float dl, dp, llp, ppp;
- float3 p;
- 
- if(!valid1 && ! valid2)
- {
-    linearSearch(x, R, N, mp3Dist, minMax, p, dl, dp, llp, ppp);
-    if(dot(p,p) != 0)
-    {
-     Il.a = 1;    
-     secantSearch(x, R, mp3Dist, dl, dp, llp, ppp, p);
-     Il.rgb =  Nl.rgb = readCubeMap(mp3Color, p).rgb;  
-    }
-    else
-     Il = float4(0,0,0,0);
- }
- else
- {
-    if( !valid2 || (valid1 && dp1 < dp2))
-    {
-     secantSearch(x, R, mp1, dl1, dp1, llp1, ppp1, p1);
-     Il.rgb =  Nl.rgb = readCubeMap(mp1, p1).rgb;
-     p = p1;
-    }
-    else
-    {
-     secantSearch(x, R, mp2, dl2, dp2, llp2, ppp2, p2);
-     Il.rgb =  Nl.rgb = readCubeMap(mp2, p2).rgb;
-     p = p2;
-    }    
- } 
- return p;
-}
-
-struct VertOut
-{
-	float3 wPos	: TEXCOORD1;
-	float3 cPos	: TEXCOORD3;
-	float2 texCoord : TEXCOORD0;
-	float3 mNormal  : TEXCOORD2;
-	float4 hPos : POSITION;			
-};
-
-VertOut DefaultVS(float4 position : POSITION,						
-				float2 texCoord : TEXCOORD0,
-				float3 normal   : NORMAL,
-				uniform float4x4 worldViewProj,
-				uniform float4x4 world,
-				uniform float4x4 worldview,
-				uniform float4x4 worldI	)
-{
-  VertOut OUT;
-  OUT.hPos = mul(worldViewProj, position);
-  OUT.wPos = mul(world, position).xyz;  
-  OUT.cPos = mul(worldview, position).xyz;  
-  OUT.mNormal = mul(normal, worldI);  
-  //OUT.mNormal = normal;
-  OUT.texCoord = texCoord;
-  return OUT;
-}
-
-float4 SingleReflectionPS(VertOut IN,
-							uniform float3 cameraPos,
-							uniform samplerCUBE CubeMap : register(s0),
-							uniform samplerCUBE DistanceMap : register(s1),
-							uniform samplerCUBE NormDistMap1 : register(s2),
-							uniform samplerCUBE NormDistMap2 : register(s3),
-							uniform float3 lastCenter,
-							uniform float refIndex,
-							float2 minMax,
-							float2 minMax1,
-							float2 minMax2
-							)
-{
- float4 Color = float4(1,1,1,1);
-		
- float3 N = normalize(IN.mNormal);
- float3 newTexCoord;	
- float3 x = IN.wPos - lastCenter;
- float3 V  = (IN.wPos - cameraPos);
- 
- V = normalize(V);
-
-float3 R;	   
-
-R = normalize(reflect( V, N));
-			
- float3 Nl;
- float4 Il;
- float3 l = Hit(x, R, N, NormDistMap1, NormDistMap2, CubeMap, DistanceMap, minMax, minMax1, minMax2, Il, Nl);
- if(Il.a == 0)
-  Il = readCubeMap(CubeMap, l);
-  
- return Il;
-}
-
-#define REFRACTION 0
-
-float4 MultipleReflectionPS(VertOut IN,
-							uniform float3 cameraPos,
-							uniform samplerCUBE CubeMap : register(s0),
-							uniform samplerCUBE DistanceMap : register(s1),
-							uniform samplerCUBE NormDistMap1 : register(s2),
-							uniform samplerCUBE NormDistMap2 : register(s3),
-							uniform float3 lastCenter,
-							uniform float refIndex,
-							float2 minMax,
-							float2 minMax1,
-							float2 minMax2)
-{
-	 float4 I = float4(0,0,0,0);
-			
-	 float3 N = normalize(IN.mNormal);
-	 float3 x = IN.wPos - lastCenter;
-	 float3 V  = (IN.wPos - cameraPos);
-	 
-	 float Fp = 0.04;
-	 float F = Fp + pow(1 - dot(N, -V), 5) * (1 - Fp);
-	 
-	 V = normalize(V);
-	 float3 l;
-	 float4 Irefl;
-	 int depth = 0;
-	
-	 while(depth < MAX_RAY_DEPTH)
-	 {
-	    float3 R;  
-	   R = normalize(reflect( V, N));	  
-	  	
-	   float3 Nl;
-	   float4 Il;
-	   l = Hit(x, R, N, NormDistMap1, NormDistMap2, CubeMap, DistanceMap, minMax, minMax1, minMax2, Il, Nl);
-	   if(Il.a == 0)
-	   {
-		   depth += 1;		 
-	   }
-	   else
-	   {
-		   I = Il;
-		   depth = MAX_RAY_DEPTH;
-	   }
-	   x = l;	   
-	   N = Nl;
-	   V = R;   
-	   
-	}
-	if(I.a == 0)
-	   I = readCubeMap(CubeMap, l);
-	Irefl = I;
-	
-	if(REFRACTION)
-	{
-		float4 Irefr;
-		N = normalize(IN.mNormal);
-		x = IN.wPos - lastCenter;
-		V  = (IN.wPos - cameraPos);
-		depth = 0;
-		while(depth < MAX_RAY_DEPTH)
-		{
-		  float3 R;  
-		   //R = normalize(reflect( V, N));
-		     
-		  
-		  float ri = refIndex;
-		  
-		  if(dot(V,N) > 0)
-		  {
-			ri = 1.0 / ri;
-			N = -N;	    
-		  }
-		  R = refract( V, N, ri);
-		  if(dot(R,R) == 0) R = reflect( V, N); 
-		  
-					
-		   float3 Nl;
-		   float4 Il;
-		   l = Hit(x, R, N, NormDistMap1, NormDistMap2, CubeMap, DistanceMap, minMax, minMax1, minMax2, Il, Nl);
-		   if(Il.a == 0)
-		   {
-			   depth += 1;		 
-		   }
-		   else
-		   {
-			   I = Il;
-			   depth = MAX_RAY_DEPTH;
-		   }
-		   x = l;	   
-		   N = normalize(Nl);
-		   V = R;	   	   
-		}
-		
-		if(I.a == 0)
-		   I = readCubeMap(CubeMap, l);
-		Irefr = I;
-	    
-		I = Irefl * F + (1.0 - F) * Irefr;
-    }
- 	return I;
-}
-/*
-float4 mainPS(VertOut IN,
-							uniform float3 cameraPos,
-							uniform samplerCUBE CubeMap : register(s0),
-							uniform samplerCUBE DistanceMap : register(s1),
-							uniform samplerCUBE NormDistMap1 : register(s2),
-							uniform samplerCUBE NormDistMap2 : register(s3),
-							uniform float3 lastCenter,
-							uniform float SingleBounce,
-							uniform float refIndex,
-							uniform float4 minmax,
-							uniform float4 minmax1,
-							uniform float4 minmax2
-							):COLOR
-{
-   float2 miniMaxi1;
-   miniMaxi1.x = 1.0 / minmax.x / 1.8;
-   miniMaxi1.y = minmax.y * 1.8;
-   
-   float2 miniMaxi2;
-   miniMaxi2.x = 1.0 / minmax1.x / 1.8;
-   miniMaxi2.y = minmax1.y * 1.8;
-   
-   float2 miniMaxi3;
-   miniMaxi3.x = 1.0 / minmax2.x / 1.8;
-   miniMaxi3.y = minmax2.y * 1.8;
-
-   float4 Color = 1.0;
-   if(SingleBounce == 1)
-     Color = SingleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter,refIndex, miniMaxi1, miniMaxi2, miniMaxi3);
-   else
-      Color = MultipleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter,refIndex, miniMaxi1, miniMaxi2, miniMaxi3);
-   
-   return Color;
-}
-*/
-
-float4 mainPS(VertOut IN,
-							uniform float3 cameraPos,
-							uniform samplerCUBE CubeMap : register(s0),
-							uniform samplerCUBE DistanceMap : register(s1),
-							uniform samplerCUBE NormDistMap1 : register(s2),
-							uniform samplerCUBE NormDistMap2 : register(s3),
-							uniform float3 lastCenter,
-							uniform float SingleBounce,
-							uniform float refIndex,
-							uniform float4 min,
-							uniform float4 min1,
-							uniform float4 min2,
-							uniform float4 max,
-							uniform float4 max1,
-							uniform float4 max2
-							):COLOR
-{
-   float2 miniMaxi1;
-   miniMaxi1.x = min.a;
-   miniMaxi1.y = max.a;
-   
-   float2 miniMaxi2;
-   miniMaxi2.x = min1.a;
-   miniMaxi2.y = max1.a;
-   
-   float2 miniMaxi3;
-   miniMaxi3.x = min2.a;
-   miniMaxi3.y = max2.a;
-
-	float4 Color = 1.0;
-	if(SingleBounce == 1)
-	 Color = SingleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter,refIndex, miniMaxi1, miniMaxi2, miniMaxi3);
-	else
-	 Color = MultipleReflectionPS(IN,cameraPos, CubeMap, DistanceMap, NormDistMap1,NormDistMap2,lastCenter,refIndex, miniMaxi1, miniMaxi2, miniMaxi3);
-	 
-	return Color;
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/kupola.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/kupola.hlsl	(revision 1683)
+++ 	(revision )
@@ -1,26 +1,0 @@
-
-
-struct VertOut
-{
-float4 hPosition :POSITION;
-float2 texCoord :TEXCOORD;
-};
-
-VertOut vs(float4 position:POSITION,
-	   float4 texCoord :TEXCOORD,
-	   uniform float4x4 worldViewProj)
-{
-VertOut OUT;
-OUT.hPosition = mul(worldViewProj, position);
-OUT.texCoord = texCoord;
-return OUT;
-
-}
-
-float4 ps(VertOut IN,
-		uniform sampler2D colorTex):COLOR
-{
-float4 Color;
-Color = tex2D(colorTex, IN.texCoord) ;
-return Color;
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_SoftShadow.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_SoftShadow.hlsl	(revision 777)
+++ 	(revision )
@@ -1,64 +1,0 @@
-struct VertOut
-{
-	float4 hPosition	:POSITION;	
-	float2 texCoord		:TEXCOORD;	
-	float3 wPosition	:TEXCOORD1;
-	float3 wNormal		:TEXCOORD2;	
-};
-
-
-VertOut deaultVS(float4 position : POSITION,
-		float3 normal:NORMAL,
-		float2 texCoord : TEXCOORD0,
-		uniform float4x4 world_IT,
-		uniform float4x4 worldViewProj,
-		uniform float4x4 world)
-{
-  VertOut OUT;
-  OUT.texCoord = texCoord;
-  OUT.hPosition = mul(worldViewProj, position);  
-  OUT.wPosition = mul(world, position).xyz;
-  OUT.wNormal = mul( normal, world_IT);
-  //OUT.wNormal = normal;
-  return OUT;    
-}
-
-float4 deaultPS(VertOut IN,
-				uniform samplerCUBE CubeMap : register(s1),
-				uniform sampler2D Texture : register(s0),
-				uniform float3 cubeMapCameraPosition):COLOR
-{
-	float4 Color = float4(1,1,1,1);	
-	
-	float3 dir = IN.wPosition - cubeMapCameraPosition;
-	float4 shadow = texCUBE(CubeMap, float3(dir.xy,-dir.z) );
-			
-	Color = tex2D(Texture, IN.texCoord) * (1.0- shadow);
-		
-	return Color;
-}
-
-
-float4 deault2PS(VertOut IN,
-				uniform samplerCUBE CubeMap : register(s0),
-				uniform float3 cubeMapCameraPosition,
-				uniform float3 lightPosition,
-				uniform float3 cameraPos
-				):COLOR
-{
-	float4 Color = float4(1,1,1,1);	
-	
-	float3 dir = IN.wPosition - cubeMapCameraPosition;
-	float4 shadow = texCUBE(CubeMap, float3(dir.xy,-dir.z) );
-	
-	IN.wNormal = normalize(IN.wNormal);
-	float3 V = normalize(IN.wPosition - cameraPos);
-	float3 L = normalize(lightPosition - IN.wPosition);
-	float3 H = normalize(L + V);
-	float4 lighting = lit(dot(IN.wNormal, L),dot(IN.wNormal, H), 80);
-	
-			
-	Color = (1.0 - shadow ) *  lighting.y * float4(0.4, 0.7, 0.6, 1) + lighting.z;
-		
-	return Color;
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Diffuse.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Diffuse.hlsl	(revision 2054)
+++ 	(revision )
@@ -1,527 +1,0 @@
-float REDUCED_CUBEMAP_SIZE;
-int CUBEMAP_SIZE = 128;
-int RATE = 32;
-
-float4 readCubeMap(samplerCUBE cm, float3 coord)		
-{
-	float4 color = texCUBElod( cm, float4(coord.xy, -coord.z, 1) );
-	color.a = 1;
-	return color;
-}
-
-float readDistanceCubeMap(samplerCUBE dcm, float3 coord)		
-{
-	float dist = texCUBElod(dcm, float4(coord.xy, - coord.z, 1)).r;
-	if(dist == 0) dist = 1000000; ///sky
-	return dist;
-}
-
-
-/////
-/// Reduce cube map shader
-/////
-struct MPos_OUT
-{
- float4 VPos : POSITION;
- float4 MPos : TEXCOORD0;
-};
-
-float4 ReduceCubeMap_PS(MPos_OUT IN,
-						uniform int nFace,
-						uniform samplerCUBE EnvironmentMapSampler : register(s0) ) : COLOR
-{  
-   RATE = 32;
-   CUBEMAP_SIZE = 128;
-   float4 color = 0;
-   float3 dir;
-  
-   for (int i = 0; i < RATE; i++)
-     for (int j = 0; j < RATE; j++)
-    {
-		float2 pos;
-		pos.x = IN.mPos.x + (2*i + 1)/(float)CUBEMAP_SIZE;
-		pos.y = IN.mPos.y - (2*j + 1)/(float)CUBEMAP_SIZE;	// y=-u
-
-		// "scrambling"
-		if (nFace == 0)	dir = float3(1, pos.y, -pos.x);
-		if (nFace == 1) dir = float3(-1, pos.y, pos.x);
-		if (nFace == 2) dir = float3(pos.x, 1, -pos.y);
-		if (nFace == 3) dir = float3(pos.x, -1, pos.y);
-		if (nFace == 4) dir = float3(pos.x, pos.y, 1);
-		if (nFace == 5) dir = float3(-pos.x, pos.y,-1);
-
-		color += texCUBE( EnvironmentMapSampler, dir);
-    }
- 
-	return color / (RATE*RATE);		
-}
-
-
-/////////////////////
-///// Diffuse
-///////////////////
-
-float4 GetContibution(float3 L, float3 L1, float3 L2, float3 L3, float3 L4, float3 pos, float3 N, samplerCUBE cubemap)
-{
-	float d;
-	//d = texCUBE(cubemap, L).a;	
-	d = readDistanceCubeMap(cubemap, L1).r;	
-	L1 = d * normalize(L1);
-	d = readDistanceCubeMap(cubemap, L2).r;	
-	L2 = d * normalize(L2);
-	d = readDistanceCubeMap(cubemap, L3).r;	
-	L3 = d * normalize(L3);
-	d = readDistanceCubeMap(cubemap, L4).r;	
-	L4 = d * normalize(L4);
-		
-	
-    float3 r1 = normalize(L1 - pos);    
-    float3 r2 = normalize(L2 - pos);
-    float3 r3 = normalize(L3 - pos);
-    float3 r4 = normalize(L4 - pos);
-  /*     	
-	float tri1 = acos(dot(r1, r2)) * dot(cross(r1, r2), N);
-	float tri2 = acos(dot(r2, r3)) * dot(cross(r2, r3), N);
-	float tri3 = acos(dot(r3, r4)) * dot(cross(r3, r4), N);
-	float tri4 = acos(dot(r4, r1)) * dot(cross(r4, r1), N);
-  */
-  float3 crossP = cross(r1, r2);
-  float r = length(crossP);
-  float dd = dot(r1,r2);
-  float tri1 = acos(dd) * dot(crossP/r, N);
-  
-  crossP = cross(r2, r3);
-  r = length(crossP);
-  dd = dot(r1,r2);
-  float tri2 = acos(dd) * dot(crossP/r, N);
-  
-  crossP = cross(r3, r4);
-  r = length(crossP);
-  dd = dot(r1,r2);
-  float tri3 = acos(dd) * dot(crossP/r, N);
-  
-  crossP = cross(r4, r1);
-  r = length(crossP);
-  dd = dot(r1,r2);
-  float tri4= acos(dd) * dot(crossP/r, N);
-  
-  
-	return max(tri1 + tri2 + tri3 + tri4, 0);	
-	//return tri1 + tri2 + tri3 + tri4;	
-}
-
-
-struct vertOUT
-{
-	float4 hPos :POSITION;
-	float3 wPos	:TEXCOORD1;
-	float2 texCoord :TEXCOORD0;
-	float3 mNormal :TEXCOORD2;
-};
-
-vertOUT DiffuseVS(float4 position : POSITION,
-		float3 normal   : NORMAL,
-		half3 tangent   : TEXCOORD1, 
-		float2 texCoord : TEXCOORD0,			
-		uniform float4x4 worldViewProj,
-		uniform float4x4 worldI,
-		uniform float4x4 world)
-{
-  vertOUT OUT;
-  OUT.hPos = mul(worldViewProj, position);
-  OUT.wPos = mul(world, position).xyz;  
-  OUT.mNormal = mul(normal, worldI);
-  //OUT.mNormal = normal;
-  OUT.texCoord = texCoord;
-  return OUT;
-}
-
-
-float4 DiffusePS( vertOUT IN,
-           uniform float3 cameraPos,
-           uniform float3 lastCenter,	//LI//
-           uniform samplerCUBE SmallEnvMapSampler : register(s0),
-           uniform samplerCUBE DistanceEnvMapSampler : register(s1)
-            ) : COLOR0
-{
-    float M = 4;
-	
-   	float3 N = IN.mNormal;
-    N = normalize( N ); 
-    float3 pos = IN.wPos - lastCenter;
-    
-    //return  float4(N,1)+ lastCenter.x*0.000001; 
-   // return float4(N,1)+ lastCenter.x*0.000001; 
-  //  return  readCubeMap(SmallEnvMapSampler, pos) + lastCenter.x*0.000001;
-    
-    float4 I = 0;									
-	float3 L1, L2, L3, L4, L;						
-	float4 Le;										
-	float width = 1.0 / M;							
-	float width2 = width * 2;
-	float d; 
-	
-	for (float x = 1; x < M; x++)			
-	 for (float y = 1; y < M; y++)										
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;
-	    tpos.y = y * width;
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L1 = float3(p.x - width, p.y - width, 1);	
-		L2 = float3(p.x + width, p.y - width, 1);	
-		L3 = float3(p.x + width, p.y + width, 1);	
-		L4 = float3(p.x - width, p.y + width, 1);
-		L = float3(p.x, p.y, 1);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-			
-	}																			
-	/*
-	for (float x = 1; x < M; x++)			
-	 for (float y = 1; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L4 = float3(p.x - width, p.y - width, -1);	
-		L3 = float3(p.x + width, p.y - width, -1);	
-		L2 = float3(p.x + width, p.y + width, -1);	
-		L1 = float3(p.x - width, p.y + width, -1);
-		L = float3(p.x, p.y, -1);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-	 }	
-	 
-	for (float x = 1; x < M; x++)			
-	 for (float y = 1; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L4 = float3(p.x - width, 1, p.y - width);
-		L3 = float3(p.x + width, 1, p.y - width);	
-		L2 = float3(p.x + width, 1, p.y + width);	
-		L1 = float3(p.x - width, 1, p.y + width);			
-		L = float3(p.x, 1, p.y);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-	 }		
-	 
-	for (float x = 1; x < M; x++)			
-	 for (float y = 1; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L1 = float3(p.x - width, -1, p.y - width);
-		L2 = float3(p.x + width, -1, p.y - width);	
-		L3 = float3(p.x + width, -1, p.y + width);	
-		L4 = float3(p.x - width, -1, p.y + width);			
-		L = float3(p.x, -1, p.y);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-	 }
-	 
-	 for (float x = 1; x < M; x++)			
-	 for (float y = 1; y < M; y++)										
-		{																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L1 = float3(1, p.x - width, p.y - width);
-		L2 = float3(1, p.x + width, p.y - width);	
-		L3 = float3(1, p.x + width, p.y + width);	
-		L4 = float3(1, p.x - width, p.y + width);	
-		L = float3(1, p.x, p.y);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-	}
-	 
-	for (float x = 1; x < M; x++)			
-	 for (float y = 1; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L4 = float3(-1, p.x - width, p.y - width);
-		L3 = float3(-1, p.x + width, p.y - width);	
-		L2 = float3(-1, p.x + width, p.y + width);	
-		L1 = float3(-1, p.x - width, p.y + width);	
-		L = float3(-1, p.x, p.y);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);				
-	 }	*/
-	 float kd = 0.5;																		
-	return kd * I;
-}
-
-struct vertOUTBump
-{
-	float4 hPos :POSITION;
-	float3 wPos	:TEXCOORD1;
-	float2 texCoord :TEXCOORD0;
-	float3 mNormal  :TEXCOORD2;
-	float3 tangent  :TEXCOORD3;
-	float3 binormal :TEXCOORD4;
-};
-
-vertOUTBump DiffuseBumpVS(float4 position : POSITION,
-		float3 normal   : NORMAL,
-		half3 tangent   : TEXCOORD1, 
-		float2 texCoord : TEXCOORD0,			
-		uniform float4x4 worldViewProj,
-		uniform float4x4 world)
-{
-  vertOUTBump OUT;
-  OUT.hPos = mul(worldViewProj, position);
-  OUT.wPos = mul(world, position).xyz;  
-  OUT.mNormal = normal;
-  OUT.tangent  = tangent;
-  OUT.texCoord = texCoord;
-  OUT.binormal = cross(tangent, normal);
-  return OUT;
-}
-
-float4 DiffuseBumpPS( vertOUTBump IN,
-           uniform float3 cameraPos,
-           uniform float3 lastCenter,	//LI//
-           uniform samplerCUBE SmallEnvMapSampler : register(s0),
-           uniform samplerCUBE DistanceEnvMapSampler : register(s1),
-	   uniform sampler2D NormalMap : register(s2),
-	   uniform float4x4 worldI
-            ) : COLOR0
-{
-    float M = 4;
-	
-    float3 N = IN.mNormal;
-    N = normalize( N ); 
-    float3x3 TangentToModel = float3x3(IN.tangent, IN.binormal, N);
-    
-    half3 tNormal = tex2D(NormalMap, IN.texCoord).rgb;  
-    
-    N = mul(tNormal, TangentToModel );    
-     
-    N = normalize( N ); 
-    N = mul(N, worldI);
-
-    float3 pos = IN.wPos - lastCenter;
-    
-    //return float4(N,1)+ lastCenter.x*0.000001; 
-  //  return  readCubeMap(SmallEnvMapSampler, pos) + lastCenter.x*0.000001;
-    
-    float4 I = 0;									
-	float3 L1, L2, L3, L4, L;						
-	float4 Le;										
-	float width = 1.0 / M;							
-	float width2 = width * 2;
-	float d; 
-	/*
-	for (float x = 0.5; x < M; x++)			
-	 for (float y = 0.5; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;
-	    tpos.y = y * width;
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L1 = float3(p.x - width, p.y - width, 1);	
-		L2 = float3(p.x + width, p.y - width, 1);	
-		L3 = float3(p.x + width, p.y + width, 1);	
-		L4 = float3(p.x - width, p.y + width, 1);
-		L = float3(p.x, p.y, 1);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-			
-	}																			
-	
-	for (float x = 0.5; x < M; x++)			
-	 for (float y = 0.5; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L4 = float3(p.x - width, p.y - width, -1);	
-		L3 = float3(p.x + width, p.y - width, -1);	
-		L2 = float3(p.x + width, p.y + width, -1);	
-		L1 = float3(p.x - width, p.y + width, -1);
-		L = float3(p.x, p.y, -1);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-	 }	
-	 
-	for (float x = 0.5; x < M; x++)			
-	 for (float y = 0.5; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L4 = float3(p.x - width, 1, p.y - width);
-		L3 = float3(p.x + width, 1, p.y - width);	
-		L2 = float3(p.x + width, 1, p.y + width);	
-		L1 = float3(p.x - width, 1, p.y + width);			
-		L = float3(p.x, 1, p.y);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-	 }		
-	 
-	for (float x = 0.5; x < M; x++)			
-	 for (float y = 0.5; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L1 = float3(p.x - width, -1, p.y - width);
-		L2 = float3(p.x + width, -1, p.y - width);	
-		L3 = float3(p.x + width, -1, p.y + width);	
-		L4 = float3(p.x - width, -1, p.y + width);			
-		L = float3(p.x, -1, p.y);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-	 }
-	 
-	 for (float x = 0.5; x < M; x++)			
-		for (float y = 0.5; y < M; y++)											
-		{																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L1 = float3(1, p.x - width, p.y - width);
-		L2 = float3(1, p.x + width, p.y - width);	
-		L3 = float3(1, p.x + width, p.y + width);	
-		L4 = float3(1, p.x - width, p.y + width);	
-		L = float3(1, p.x, p.y);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);			
-	}
-	 
-	for (float x = 0.5; x < M; x++)			
-	 for (float y = 0.5; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;	// 0..1
-	    tpos.y = y * width;	// 0..1
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		L4 = float3(-1, p.x - width, p.y - width);
-		L3 = float3(-1, p.x + width, p.y - width);	
-		L2 = float3(-1, p.x + width, p.y + width);	
-		L1 = float3(-1, p.x - width, p.y + width);	
-		L = float3(-1, p.x, p.y);
-		Le = float4(readCubeMap(SmallEnvMapSampler, L).rgb, 1);
-		
-		I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);				
-	 }	*/
-	 float kd = 0.3;																		
-	return kd * I;
-}
-
-float4 P2PContr(float3 N, float3 Nl, float3 pos, float3 L, samplerCUBE cubemap, samplerCUBE distmap)
-{
-	Nl = normalize(Nl);
-	L = normalize(L);
-	float4 Le = readCubeMap(cubemap, L);
-	float d = readDistanceCubeMap(distmap, L);
-	float3 Lpos = L * d;
-	float3 Ldir = Lpos - pos;
-	float dist = 4 * dot(Ldir, Ldir);
-	Ldir = normalize(Ldir);
-		
-	return Le * (max(dot(N, Ldir),0) * dot(Nl, -1 * Ldir)) / dist;	
-}
-
-float4 EnvMapDiffuseP2PPS( vertOUT IN,
-							uniform float3 lastCenter,	//LI//
-							uniform samplerCUBE SmallEnvMapSampler : register(s0),
-							uniform samplerCUBE DistanceEnvMapSampler : register(s1)) : COLOR			
-{		
-	float M = 4.0;	
-	
-    float3 N = IN.mNormal;
-    N = normalize( N ); 
-    float3 pos = IN.wPos - lastCenter;																		
-													
-    float4 I = 0;									
-	float3 L;						
-	float4 Le;										
-	float width = 1.0 / M;
-	float d;	
-	
-	float kd = 0.3;																		
-	
-	//return kd * readCubeMap(SmallEnvMapSampler, N) + lastCenter.x * 0.00000001;
-	
-	for (float x = 0.5; x < M; x++)			
-	 for (float y = 0.5; y < M; y++)											
-	 {																
-		float2 p, tpos; 
-	    tpos.x = x * width;
-	    tpos.y = y * width;
-	    
-	    p = tpos.xy;    
-	    p = 2.0 * p - 1.0; //-1..1
-	    	    	    
-		I += P2PContr(N, float3(0,0,-1), pos, float3(p.x, p.y, 1), SmallEnvMapSampler, DistanceEnvMapSampler);
-		I += P2PContr(N, float3(0,0,1), pos, float3(-p.x, p.y, -1), SmallEnvMapSampler, DistanceEnvMapSampler);
-		I += P2PContr(N, float3(-1,0,0), pos, float3(1, p.y, -p.x), SmallEnvMapSampler, DistanceEnvMapSampler);
-		I += P2PContr(N, float3(1,0,0), pos, float3(-1, p.y, p.x), SmallEnvMapSampler, DistanceEnvMapSampler);
-		I += P2PContr(N, float3(0,-1,0), pos, float3(p.x, 1, -p.y), SmallEnvMapSampler, DistanceEnvMapSampler);
-		I += P2PContr(N, float3(0,1,0), pos, float3(p.x, -1, p.y), SmallEnvMapSampler, DistanceEnvMapSampler);
-	}
-																		
-	return kd * I;															
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_UV.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_UV.hlsl	(revision 777)
+++ 	(revision )
@@ -1,24 +1,0 @@
-struct VS_OUT
-{
-	float4 hPosition	: POSITION;
-	float3 texCoord 	: TEXCOORD0;
-};
-
-VS_OUT UV_VS(float4 position : POSITION,	
-		float3 texCoord: TEXCOORD0,	
-		float3 texCoord1: TEXCOORD1,	
-		uniform float4x4 worldViewProj)
-{
-  VS_OUT OUT;
-  OUT.hPosition = mul(worldViewProj, position);
-  OUT.texCoord = texCoord1; 
-  return OUT;
-}
-
-
-float4 UV_PS(VS_OUT IN,
-			uniform float4 ID):COLOR
-{
-  return float4(IN.texCoord.xyz, ID.x);
-  //return float4(ID.x,0,0,1);
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/textured.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/textured.hlsl	(revision 1683)
+++ 	(revision )
@@ -1,26 +1,0 @@
-
-
-struct VertOut
-{
-float4 hPosition :POSITION;
-float2 texCoord :TEXCOORD;
-};
-
-VertOut vs(float4 position:POSITION,
-	   float4 texCoord :TEXCOORD,
-	   uniform float4x4 worldViewProj)
-{
-VertOut OUT;
-OUT.hPosition = mul(worldViewProj, position);
-OUT.texCoord = texCoord;
-return OUT;
-
-}
-
-float4 ps(VertOut IN,
-		uniform sampler2D colorTex):COLOR
-{
-float4 Color;
-Color = tex2D(colorTex, IN.texCoord) * 10.0;
-return Color;
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Caustic.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Caustic.hlsl	(revision 1094)
+++ 	(revision )
@@ -1,51 +1,0 @@
-
-float readDistanceCubeMap(samplerCUBE dcm, float3 coord)		
-{
-	float dist = texCUBE(dcm, float3(coord.xy, - coord.z)).r;
-	if(dist == 0) dist = 10000; ///sky
-	return dist;
-}
-
-struct VertOut
-{
-	float4 hPosition	:POSITION;	
-	float2 texCoord		:TEXCOORD;	
-	float3 wPosition	:TEXCOORD1;	
-};
-
-
-VertOut deaultVS(float4 position : POSITION,
-		float2 texCoord : TEXCOORD0,
-		uniform float4x4 worldViewProj,
-		uniform float4x4 world)
-{
-  VertOut OUT;
-  OUT.texCoord = texCoord;
-  OUT.hPosition = mul(worldViewProj, position);  
-  OUT.wPosition = mul(world, position).xyz;
-  return OUT;    
-}
-
-float4 deaultPS(VertOut IN,
-				uniform samplerCUBE CubeMap : register(s0),
-				uniform samplerCUBE distanceCube : register(s1),
-				uniform float3 cubeMapCameraPosition,
-				uniform float attenuation):COLOR
-{
-	float4 Color = float4(1,1,1,1);	
-	
-	float3 dir = IN.wPosition - cubeMapCameraPosition;
-	float4 caustic = texCUBE(CubeMap, float3(dir.xy,-dir.z) );
-	float mydist = length(dir);
-	float dist = readDistanceCubeMap(distanceCube, dir);
-	
-	float EPSILON = 1.0;
-
-	if(mydist > dist + EPSILON) caustic = 0;
-	//caustic.rgb *= max(attenuation - mydist, 0.0) / attenuation;
-			
-	Color = caustic;
-	Color += attenuation;
-	Color.a = 1;	
-	return Color;
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_CausticSoftShadow.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_CausticSoftShadow.hlsl	(revision 807)
+++ 	(revision )
@@ -1,76 +1,0 @@
-float4x4 world_IT;
-
-float3x3 TransfModelToTangent( in  half3 Tangent, in half3 Binormal, in half3 Normal ) {
-	half T2 = dot(Tangent, Tangent);
-	half B2 = dot(Binormal, Binormal);
-	half N2 = dot(Normal, Normal);
-	half BT = dot(Binormal, Tangent);
-	half det = B2 * T2 - BT * BT;
-
-	return float3x3( (B2 * Tangent - BT * Binormal)/det, 
-	                 (T2 * Binormal - BT * Tangent)/det, 
-	                 Normal/N2 );
-/*		                               		
-	// simplified solution
-	return float3x3(Tangent/T2, Binormal/B2, Normal/N2); 
-*/
-} 
-
-struct VertOut
-{
-	half4 hPosition	:POSITION;	
-	half2 texCoord		:TEXCOORD;	
-	half3 wPosition	:TEXCOORD1;	
-	half3 Normal		:TEXCOORD2;
-	half3 Tangent   : TEXCOORD3;	 // model space tangent vector
-    half3 Binormal  : TEXCOORD4;	 // model space binormal vector
-};
-
-
-VertOut deaultVS(half4 position : POSITION,
-		half3 normal:NORMAL,
-		half3 Tangent   : TEXCOORD1, 	 
-		half2 texCoord : TEXCOORD0,		
-		uniform float4x4 worldViewProj,
-		uniform float4x4 world)
-{
-  VertOut OUT;
-  OUT.texCoord = texCoord;
-  OUT.hPosition = mul(worldViewProj, position);  
-  OUT.wPosition = mul(world, position).xyz;
-  OUT.Normal = normal;
-  OUT.Tangent = Tangent;  
-  OUT.Binormal = cross(Tangent, normal); 
-  return OUT;    
-}
-
-half4 deaultPS(VertOut IN,
-				uniform sampler2D Texture : register(s0),
-				uniform sampler2D NormalMap : register(s1),
-				uniform half3 lightPosition,
-				uniform half3 cameraPos
-				):COLOR
-{
-	half4 Color = half4(1,1,1,1);	
-///get normal
-	float3x3 ModelToTangent = float3x3(IN.Tangent, IN.Binormal, IN.Normal); 
-	//float3x3 ModelToTangent = TransfModelToTangent(IN.Tangent, IN.Binormal, IN.Normal );
-    half3 tNormal = tex2D(NormalMap, IN.texCoord).rgb;     	
-   
-   
-    half3 wNormal =mul(tNormal, ModelToTangent );
-    //wNormal = IN.Normal;
-    wNormal = normalize(mul( wNormal, world_IT ));
-///shading
-	half3 V = normalize(IN.wPosition - cameraPos);
-	half3 light = (lightPosition - IN.wPosition) / 200.0;
-	half3 L = normalize(light);
-	half3 H = normalize(L+V);
-	half4 lighting = lit(dot(wNormal, L),dot(wNormal, H), 80);
-	
-	half4 ambient = float4(0.1, 0.1, 0.1, 1.0);
-	
-	Color = tex2D(Texture, IN.texCoord) * (lighting.y  /*+ ambient*/) + lighting.z * half4(0.3,0.3,0.3,1); 
-	
-	return Color;
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_LocalizedBump_EnvMap.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_LocalizedBump_EnvMap.hlsl	(revision 777)
+++ 	(revision )
@@ -1,340 +1,0 @@
-//metal:
-float3 n, k;	// R 700 nm, G 550 nm, B 435 nm 
-float3 F0;
-/*
-	
-	// copper	
-		n = float3(0.21f, 0.96f, 1.17f);	
-		k = float3(4.16f, 2.57f, 2.32f); }
-	// gold
-		n = float3(0.16f, 0.35f, 1.6f);		
-		k = float3(3.98f, 2.71f, 1.92f); }
-	// silver
-		n = float3(0.142f, 0.124f, 0.158f);	
-		k = float3(4.52f,  3.33f, 2.32f); }
-	// alu
-		n = float3(1.83f, 0.96f, 0.577f);
-		k = float3(8.31f,  6.69f, 5.288f); }
-
-*/	
-
-// material constants
-const float3 ambientMaterial= float3(0.3, 0.3, 0.3);
-const float3 diffuseMaterial = float3(1.0, 1.0, 1.0);	
-const float3 specularMaterial = float3(1.0, 1.0, 1.0);
-
-//------------------------------------------------------------------------------------
-void DISCARD_BY_TEX(float2 Tex)
-{
-	if (Tex.x > 1 || Tex.x < 0 || Tex.y > 1 || Tex.y < 0)
-		discard;
-}
-
-//------------------------------------------
-// Attenuation with the square of the distance
-//------------------------------------------
-float SQR(float x) { return x*x; }
-float Attenuation(float3 Light)
-{
-	return 1.0 / dot(Light, Light);
-}
-
-//-----------------------------------------------------------------------------
-// Illumination function used in shading: all input vectors are normalized
-//-----------------------------------------------------------------------------
-/*
-float4 Illumination(float3 Light, float3 Normal, float3 View, float2 TexCoord, float Attenuation)
-{
-	// Blinn lighting
-	float3 Half = normalize(Light + View);
-	float Diffuse = dot(Normal, Light);
-	float Specular = dot(Normal, Half);
-	float4 Lighting = lit(Diffuse, Specular, 16);
-	float4 Color= tex2D(ColorMapSampler, TexCoord);
-
-	return float4(
-		Lighting.x * ambientMaterial * Color +
-		(Lighting.y * diffuseMaterial * Color +
-		Lighting.z * specularMaterial) * Attenuation, 1);
-}*/
-
-//-----------------------------------------------------------------------------
-// Computes transformation matrix from modeling to tangent space
-//-----------------------------------------------------------------------------
-float3x3 TransfModelToTangent( in  float3 Tangent, in float3 Binormal, in float3 Normal ) {
-	float T2 = dot(Tangent, Tangent);
-	float B2 = dot(Binormal, Binormal);
-	float N2 = dot(Normal, Normal);
-	float BT = dot(Binormal, Tangent);
-	float det = B2 * T2 - BT * BT;
-
-	return float3x3( (B2 * Tangent - BT * Binormal)/det, 
-	                 (T2 * Binormal - BT * Tangent)/det, 
-	                 Normal/N2 );
-/*		                               		
-	// simplified solution
-	return float3x3(Tangent/T2, Binormal/B2, Normal/N2); 
-*/
-} 
-
-float4 readCubeMap(samplerCUBE cm, float3 coord)		
-{
-	float4 color = texCUBE( cm, float3(coord.xy, - coord.z) );
-	return color;
-}
-
-float readDistanceCubeMap(samplerCUBE dcm, float3 coord)		
-{
-	float dist = texCUBE(dcm, float3(coord.xy, - coord.z)).r;
-	if(dist == 0) dist = 10000; ///sky
-	return dist;
-}
-
-// This function is called several times.
-float3 Hit( float3 x, float3 R, samplerCUBE mp )
-{
-	float rl = readDistanceCubeMap( mp, R);				// |r|
-	
-	float ppp = length( x ) /  readDistanceCubeMap( mp, x);			// |p|/|p|
-	float dun = 0, pun = ppp, dov = 0, pov = 0;
-	float dl = rl * ( 1 - ppp );							// eq. 2
-	float3 l = x + R * dl;									// ray equation
-
-	// iteration
-	for( int i = 0; i < 6; i++ )	// 2 !!!!!!!!!!!!!!!!!!!!!!!
-	{
-		float llp = length( l ) / readDistanceCubeMap( mp, l);		// |l|/|l|
-		if ( llp < 0.999f )									// undershooting
-		{
-			dun = dl; pun = llp;							// last undershooting
-			dl += ( dov == 0 ) ? rl * ( 1 - llp ) :			// eq. 2
-				( dl - dov ) * ( 1 - llp ) / ( llp - pov );	// eq. 3
-		} else if ( llp > 1.001f )							// overshooting
-		{
-			dov = dl; pov = llp;							// last overshooting
-			dl += ( dl -dun ) * ( 1 - llp ) / ( llp - pun );// eq. 3
-		}
-		l = x + R * dl;										// ray equation
-	}
-	return l;												// computed hit point
-}
-
-float4 metal_reflectivity(float3 L, float3 N, float3 V)
-{
-	
-	
-	float ctheta_in = dot(N,L);
-	float ctheta_out = dot(N,V);
-
-	float4 intens = 0;
-	
-	// F,P,G számítása
-	if ( ctheta_in > 0 && ctheta_out > 0 )
-	{
-		float3 H = normalize(L + V);	// felezõvektor
-		float calpha = dot(N,H);
-		float cbeta  = dot(H,L);
-		
-		float3 F = ( (n-1)*(n-1) + pow(1-cbeta,5) * 4*n + k*k) / ( (n+1)*(n+1) + k*k );
-
-		float m = 0.8;
-		float m2 = m*m;
-		float PI = 3.14159f;
-
-		float calpha2 = calpha*calpha;
-		float salpha2 = 1-calpha2;
-		
-		float P = exp( -( salpha2 / calpha2 / m2 )) / (m2 * PI * calpha * calpha2);
-		
-		float f1 = 2*calpha*ctheta_out/cbeta;
-		float f2 = 2*calpha*ctheta_in /cbeta;
-		float G = min(1, min( f1, f2 )) / 4 / ctheta_in / ctheta_out;
-		//float GG = 1 / (4*cbeta*cbeta);
-
-		//F*P*G*ctheta_in		
-		intens += float4(F, 1) * P * G * ctheta_in;
-	}
-	
-	return 3*intens;
-}
-
-float3 expand(float3 v)
-{
-	return (v - 0.5) * 2;
-}
-
-float2 PARALLAX_MAPPING(sampler2D heightMap, float2 TexCoord, float3 View)
-{
-	float HEIGHT_SCALE = 0.06;
-	float HEIGHT_BIAS = -0.12;
-    float h = tex2D(heightMap, TexCoord).r * HEIGHT_SCALE + HEIGHT_BIAS;
-    return TexCoord + h * View.xy / View.z;
-} 
-
-struct VS_INPUT {
-    float4 Position  : POSITION;     // point in modeling space
-    float2 TexCoord	 : TEXCOORD0;    // texture coordinates
-    float3 Tangent   : TEXCOORD1;  	 // model space tangent vector
-    float3 Normal    : NORMAL;		 // model space triangle normal vector
-};
-
-struct VS_OUTPUT {
-    float4 hPosition : POSITION;     // point in normalized device space before homogeneous division
-    float2 TexCoord  : TEXCOORD0;    // texture coordinates
-    float3 Normal    : TEXCOORD1;	 // model space triangle normal vector
-    float3 wPosition : TEXCOORD2;	 // model space tangent vector
-	float3 Tangent   : TEXCOORD3;	 // model space tangent vector
-    float3 Binormal  : TEXCOORD4;	 // model space binormal vector
-}; 
-
-VS_OUTPUT LocalizedBumpVS(VS_INPUT IN,
-		uniform float4x4 worldViewProj,
-		uniform float4x4 worldViewIT,
-		uniform float4x4 world)
-{
-  VS_OUTPUT OUT;
-  OUT.hPosition = mul(worldViewProj, IN.Position);
-  OUT.wPosition = mul(world, IN.Position).xyz;  
-  //OUT.Normal = mul(worldViewIT, IN.Normal);
-  OUT.Normal = IN.Normal;
-  OUT.TexCoord = IN.TexCoord;
-  OUT.Tangent = IN.Tangent;  
-  OUT.Binormal = cross(IN.Tangent, IN.Normal); 
-  
-  return OUT;
-}
-
-//////////////
-//Localized reflection with bump
-//////////////
-/*
-VS_OUTPUT BaseVS(VS_INPUT IN)
-{
-        VS_OUTPUT OUT;
-
-		
-		OUT.Tangent = IN.Tangent;
-		OUT.Binormal = IN.Binormal;
-		OUT.Normal = IN.Normal;
-		
-        // vertex position before homogenious division
-        OUT.hPosition = mul(IN.Position, WorldViewProj);
-		// tex coordinates passed to pixel shader
-        OUT.TexCoord = IN.TexCoord0;
-
-		return OUT;
-} 
-float4 BumpPS(VS_OUTPUT IN) : COLOR
-{
-  
-    // get model space normal vector
-	float3x3 ModelToTangent = TransfModelToTangent(IN.Tangent, IN.Binormal, IN.Normal );
-    // get model space normal vector
-    float3 tNormal = tex2D(BumpMapSampler, IN.TexCoord).rgb;
-	// Normal vector should be transformed with the inverse transpose of TangentToModel
-	// which is the transpose of ModelToTangent
-    float3 mNormal = normalize( mul( tNormal, ModelToTangent ) );     
-    
-}
-*/
-
-void LocalizedBumpPS(  VS_OUTPUT IN,
-		uniform float3 cameraPos,
-		uniform samplerCUBE CubeMap : register(s0),
-		uniform samplerCUBE DistanceMap : register(s1),
-		uniform sampler2D NormalMap : register(s2),
-		uniform sampler2D DisplacementMap : register(s3),
-		uniform float3 lastCenter,
-		uniform float3 lightPosition,		
-		out float4 Color :COLOR0)
-{
-	// get model space normal vector
-	float3x3 ModelToTangent = TransfModelToTangent(IN.Tangent, IN.Binormal, IN.Normal );
-    // get model space normal vector
-	
-	//parallax
-	/*
-	float3 tView = mul(ModelToTangent, IN.wPosition ); 
-    float2 ParallaxTex = PARALLAX_MAPPING(DisplacementMap, IN.TexCoord, tView);
-    float3 tNormal = tex2D(NormalMap, ParallaxTex).rgb;	
-    */ 
-        
-    float3 tNormal = tex2D(NormalMap, IN.TexCoord).rgb;    	
-    float3 mNormal = normalize( mul( tNormal, ModelToTangent ) );
-        
-   //Color = float4(tex2D(DisplacementMap, IN.TexCoord).rgb, 1 + lastCenter.x * 0.000000001);
-	Color = float4(1,1,1,1); 
-	
-	float3 RR, TT;	
-	float3 mPos = IN.wPosition - lastCenter;
-	float3 V = normalize(IN.wPosition - cameraPos);
-	float3 R = (reflect( V, mNormal));
-	
-	float3 T = refract(V, mNormal, 0.9);
-		
-	RR = R;	TT = T;
-	RR = Hit(mPos, R, DistanceMap);
-	TT = Hit(mPos, T, DistanceMap);
-	
-	float4 reflectcolor = readCubeMap(CubeMap, RR );		
-	float4 refractcolor = readCubeMap(CubeMap, TT );		
-	
-	float cos_theta = -dot(V, mNormal);
-	float sFresnel = 0.4;
-	float F = (sFresnel + pow(1-cos_theta, 5.0f) * (1-sFresnel));
-    
-    float3 L = normalize(lightPosition - IN.wPosition);
-	float3 H = normalize(L+V);
-	float4 lighting = lit(dot(mNormal, L),dot(mNormal, H), 30);
-	Color = (F * reflectcolor + (1-F) * refractcolor)/* + lighting.z *1000*/;	
-}
-
-
-//////////////
-//Metal
-//////////////
-void LocalizedMetalPS(  float2 texCoord : TEXCOORD0, 
-		float3 wPos	: TEXCOORD1,	
-		float3 mNormal  : TEXCOORD2,
-		uniform float3 cameraPos,
-		uniform samplerCUBE CubeMap : register(s0),
-		uniform samplerCUBE DistanceMap : register(s1),
-		uniform float3 lastCenter,
-		uniform float3 lightPosition,				
-		out float4 Color :COLOR0)
-{
-	
-	Color = float4(1,1,1,1);
-	
-	mNormal = normalize(mNormal);
-	float3 newTexCoord;	
-	float3 mPos = wPos - lastCenter;
-	float3 V = normalize(wPos - cameraPos);
-	float3 R = normalize(reflect( V, mNormal));
-		
-	newTexCoord = R;	
-	
-	newTexCoord = Hit(mPos, R, DistanceMap);
-	
-	Color = readCubeMap(CubeMap, newTexCoord );	
-	
-	float ctheta_in = dot(mNormal,R);
-	float ctheta_out = dot(mNormal,-V);
-
-	float3 F = 0;
-	
-	// F,P,G számítása
-	if ( ctheta_in > 0 && ctheta_out > 0 )
-	{
-		float3 H = normalize(R - V);	// felezõvektor
-		float cbeta  = dot(H,R);		
-		//F = ( (n-1)*(n-1) + pow(1-cbeta,5) * 4*n + k*k) / ( (n+1)*(n+1) + k*k );
-		//float3 F0 = ((n-1)*(n-1) + k*k) / ( (n+1)*(n+1) + k*k );
-		//float3 F1 = float3(1.0f,1.0f,1.0f) - F0;
-		F = F0 + (1-F0)*pow(1-cbeta,5);
-	}
-	
-	//Color *= metal_reflectivity(R, mNormal, -V);
-	
-	Color = Color * float4(F,1);	
-}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_PS.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_PS.hlsl	(revision 2266)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_PS.hlsl	(revision 2294)
@@ -35,5 +35,5 @@
 {
  float4 pos = IN.VPosition / IN.VPosition.w;
- return float4(pos.z, pos.z * pos.z, 1, 1);	
+ return float4(pos.z, 0, 0, 1);	
 }
 
@@ -62,7 +62,14 @@
 
 float4 PlainTex2D(PlainTex_OUT IN,
-                uniform sampler2D Texture) : COLOR
+				  uniform sampler2D Texture) : COLOR
 {
- return IN.color * tex2D(Texture, IN.texCoord.xy);
+ return tex2D(Texture, IN.texCoord.xy);
+}
+
+float4 PlainTex2DColored(PlainTex_OUT IN,
+					uniform float4 color,
+				  uniform sampler2D Texture) : COLOR
+{
+ return color * tex2D(Texture, IN.texCoord.xy);
 }
 
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasicFSQuad.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasicFSQuad.hlsl	(revision 2294)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasicFSQuad.hlsl	(revision 2294)
@@ -0,0 +1,96 @@
+#define samplesU 7
+#define samplesV 7
+
+struct VS_INPUT {           
+    float4 Position : POSITION;
+};
+
+struct VS_OUTPUT {         
+    float4 hPosition : POSITION;
+    float2 Position  : TEXCOORD0;
+};
+
+VS_OUTPUT BlurVS(VS_INPUT IN) {
+	VS_OUTPUT OUT;
+    OUT.hPosition = IN.Position;
+    OUT.Position =(IN.Position.xy + 1.0) / 2.0;
+    OUT.Position.y = 1.0 - OUT.Position.y;
+    return OUT;
+}
+
+float4 BlurPS(VS_OUTPUT IN,
+			uniform sampler2D Texture : register(s0),
+			uniform float width,
+			uniform float height ) : COLOR
+{  
+
+  float2 pixel = float2(1.0 / width, 1.0 / height);
+  float2 uv = IN.Position + pixel * 0.5;
+
+  float4 sum = float4(0,0,0,0);
+
+	for(int i = 0; i < samplesU; i++)
+	 for(int j = 0; j < samplesU; j++)
+		sum += tex2D(Texture, uv + float2(i - samplesU * 0.5,j - samplesV * 0.5) * pixel);
+
+  sum /= samplesU * samplesV;
+
+  return sum;
+  return tex2D(Texture, uv);
+}
+
+float4 CopyPS(VS_OUTPUT IN,
+			uniform sampler2D Texture : register(s0),
+			uniform float alpha,
+			uniform float width,
+			uniform float height ) : COLOR
+{  
+  float2 pixel = float2(1.0 / width, 1.0 / height);
+  float2 uv = IN.Position + pixel * 0.5;
+
+  float4 Color = tex2D(Texture, uv);
+  Color.a = alpha;  
+ // Color = float4(0,0,0,1);
+  return Color;
+}
+
+VS_OUTPUT BlurCubeFaceVS(VS_INPUT IN) {
+	VS_OUTPUT OUT;
+    OUT.hPosition = IN.Position;   
+    OUT.Position = OUT.hPosition;
+    return OUT;
+}
+
+float4 BlurCubeFacePS(VS_OUTPUT IN,
+			uniform samplerCUBE Texture : register(s0),
+			uniform float width,
+			uniform float height,
+			uniform float face ) : COLOR
+{  
+
+  float2 pixel = float2(2.0 / width, 2.0 / height);
+  float2 uv = IN.Position + pixel * 0.5;
+
+  float4 sum = float4(0,0,0,0);
+
+	for(int i = 0; i < samplesU; i++)
+	 for(int j = 0; j < samplesV; j++)
+	 {
+		float3 dir;
+		float2 pos = uv + float2(i - samplesU * 0.5,j - samplesV * 0.5) * pixel;
+		if (face == 0) dir = float3(1, pos.y, -pos.x);
+		if (face == 1) dir = float3(-1, pos.y, pos.x);
+		if (face == 2) dir = float3(pos.x, 1, -pos.y);
+		if (face == 3) dir = float3(pos.x, -1, pos.y);
+		if (face == 4) dir = float3(pos.x, pos.y, 1);
+		if (face == 5) dir = float3(-pos.x, pos.y,-1);
+		
+		sum += texCUBE(Texture, dir);
+	 }
+		
+
+  sum /= samplesU * samplesV;
+
+  return sum;
+  //return texCUBE(Texture, float3(uv, 1)) + face * 0.0000001;
+}
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPShadowMap_PS.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPShadowMap_PS.hlsl	(revision 2271)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPShadowMap_PS.hlsl	(revision 2294)
@@ -14,10 +14,11 @@
 #define DEPTH_BIAS      0.001
 #define DEPTH_BIAS_VSM  0.001
-#define DEPTH_EPSILON   0.0005
+#define DEPTH_EPSILON   0.05
 #define DIST_BIAS       0.005
 #define DIST_BIAS_VSM   0.05
 #define DIST_EPSILON    0.01
 
-#define shadowColor float4(0.9,0.9,0.9,1)
+//#define shadowColor float4(0.9,0.9,0.9,1)
+#define shadowColor float4(0.1,0.1,0.1,1)
 
 float4 shadowMapDepth(LightVPos_OUT IN,
@@ -26,5 +27,5 @@
   float4 light = shadowColor;	  
 	
-  if(IN.LightVPos.z > 0.0)
+ // if(IN.LightVPos.z > 0.0)
   {
 	float4 pos = (IN.LightVPos / IN.LightVPos.w);
@@ -32,6 +33,7 @@
 	pos.xy = (pos.xy + 1.0) / 2.0;
 	pos.y = 1.0 - pos.y;
-	float4 storedDepth = tex2D(shadowMap, pos.xy);
-	light = max(storedDepth.r + DEPTH_BIAS >= pos.z, shadowColor);			
+	float storedDepth = abs(tex2D(shadowMap, pos.xy).r);
+	//light = (pos.z - storedDepth.r)*100.0;
+	light = max(storedDepth + DEPTH_BIAS > pos.z, shadowColor);			
   }		
   return light;	
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.program
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.program	(revision 2266)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.program	(revision 2294)
@@ -144,4 +144,11 @@
    source GTPBasic_PS.hlsl
    entry_point PlainTex2D
+   target ps_2_0
+}
+
+fragment_program GTP/Basic/PlainTex2DColored_PS hlsl
+{
+   source GTPBasic_PS.hlsl
+   entry_point PlainTex2DColored
    target ps_2_0
 }
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_VS.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_VS.hlsl	(revision 2181)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_VS.hlsl	(revision 2294)
@@ -24,5 +24,5 @@
 
 PlainTex_OUT PlainTex_VS(float4 position : POSITION,
-		   float4 color : COLOR0,
+		   		   float4 color : COLOR,
                    float4 texCoord : TEXCOORD0,
                    uniform float4x4 WorldViewProj)
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.material	(revision 2284)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.material	(revision 2294)
@@ -44,5 +44,5 @@
   pass mainpass
   {
-   cull_hardware clockwise
+   cull_hardware none
    vertex_program_ref GTP/Basic/VPos_VS
    {  
@@ -69,7 +69,7 @@
 material GTP/Basic/CameraDepth
 {
- technique
- {
-  pass
+ technique maintechnique
+ {
+  pass mainpass
   {
    cull_hardware clockwise
@@ -86,19 +86,11 @@
 }
 
-material GTP/Basic/CameraDepthCCW : GTP/Basic/CameraDepthCCW
-{
- technique
- {
-  pass
-  {
-   cull_hardware anticlockwise
-   vertex_program_ref GTP/Basic/CPos_VS
-   {  
-     param_named_auto WorldViewProj worldviewproj_matrix
-     param_named_auto WorldView     worldview_matrix     
-   } 
-   fragment_program_ref GTP/Basic/CDepth_PS
-   {	
-   }   
+material GTP/Basic/CameraDepthCCW : GTP/Basic/CameraDepth
+{
+ technique maintechnique
+ {
+  pass mainpass
+  {
+   cull_hardware anticlockwise   
   }
  }
@@ -173,13 +165,13 @@
   {
 	vertex_program_ref GTP/Basic/LightVPos_VS
-        {       
-	    param_named_auto 	World		world_matrix
-            param_named_auto 	WorldViewProj	worldviewproj_matrix
-	    param_named 	LightViewProj	matrix4x4	 
-        } 
+    {       
+	    param_named_auto 	World			world_matrix
+        param_named_auto 	WorldViewProj	worldviewproj_matrix
+	    param_named			LightViewProj	matrix4x4 1 0 0 0 0 1 0 0 0 0  1 0 0 0 0 1
+    } 
 	fragment_program_ref  GTP/Basic/LightVPos_PS
-        { 
+    { 
 	   
-        }
+    }
   }
  }		
