Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/MetalTeapot.material
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/MetalTeapot.material	(revision 1735)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/MetalTeapot.material	(revision 1854)
@@ -190,5 +190,6 @@
 			//param_named n float3 0.21 0.96 1.17
 			//param_named k float3 4.16 2.57 2.32
-			param_named F0 float3 0.95 0.95 0.95			
+			param_named F0 float3 0.95 0.95 0.95
+			param_named SingleBounce float 0.0			
 		} 
 		
Index: GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl
===================================================================
--- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl	(revision 1853)
+++ GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl	(revision 1854)
@@ -175,14 +175,12 @@
 //Metal
 //////////////
-void Metal1BouncePS(  VertOut IN,
+float4 Metal1BouncePS(  VertOut IN,
 		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);
+		uniform float3 lastCenter):COLOR0
+{
+	
+	float4 Color = float4(1,1,1,1);
 	
 	IN.mNormal = normalize(IN.mNormal);
@@ -211,5 +209,7 @@
 	}	
 	
-	Color = Color * float4(F,1);	
+	Color = Color * float4(F,1);
+	
+	return Color;	
 }
 
@@ -222,112 +222,92 @@
 		uniform samplerCUBE NormDistMap2 : register(s3),
 		uniform float3 lastCenter,
+		uniform float SingleBounce,
 		out float4 Color :COLOR0)
 {
-	
-	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(NormDistMap1, mPos );
-	//return;
-	
-
-	float3 newDir1;
-	float d1 = Hit(mPos, R, NormDistMap1, newDir1);
-	float3 normal1 = readCubeMap(NormDistMap1, newDir1);
-	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);
-	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;			
+	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(NormDistMap1, mPos );
+		//return;
+		
+
+		float3 newDir1;
+		float d1 = Hit(mPos, R, NormDistMap1, newDir1);
+		float3 normal1 = readCubeMap(NormDistMap1, newDir1);
+		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);
+		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);	*/
 	}
-	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);	
-	}
-	
-	/*
-	float3 newDir2;
-	float d2 = Hit(mPos, R, NormDistMap2, newDir2);
-	float3 normal2 = readCubeMap(NormDistMap2, newDir2);
-	bool valid2 = dot(normal2, R) < 0 && dot(newDir2,newDir2) != 0;
-	if(valid2)
-		newDir2 = 0;
-	if(valid2)
-	{
-		float d;
-		float3 newN;		
-		d = d2;
-		newN = normal2;
-		float3 newV = R;
-		float3 newX = mPos + R * d;
-		float3 newR = normalize(reflect( newV, newN));
-		
-		Hit(newX, newR, DistanceMap, newTexCoord);	
-		Color = readCubeMap(CubeMap, newTexCoord );
-	}
-	else
-	{
-		Hit(mPos, R, DistanceMap, newTexCoord);	
-		Color = readCubeMap(CubeMap, newTexCoord );
-	}
-	*/	
-	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);	
 }
 
