Index: /GTP/trunk/App/Demos/Illum/EnvMap/.matrix
===================================================================
--- /GTP/trunk/App/Demos/Illum/EnvMap/.matrix	(revision 1573)
+++ /GTP/trunk/App/Demos/Illum/EnvMap/.matrix	(revision 1574)
@@ -1,12 +1,12 @@
 
 World matrix:
-         1          0          0          0
-         0          1          0          0
-         0          0          1          0
-         0          0       6.82          1
+    0.9135     0.2775    -0.2975          0
+   -0.2198      0.952     0.2132          0
+    0.3424    -0.1293     0.9306          0
+         0  5.96e-008      2.399          1
 
 Camera position:
-         0          0      -6.82
+  0.713843   -0.51149   -2.23277
 
 Mesh position:
-   1.49802          0   -1.49802
+ -0.331426   0.385354    1.32215
Index: /GTP/trunk/App/Demos/Illum/EnvMap/.params
===================================================================
--- /GTP/trunk/App/Demos/Illum/EnvMap/.params	(revision 1573)
+++ /GTP/trunk/App/Demos/Illum/EnvMap/.params	(revision 1574)
@@ -4,9 +4,9 @@
 (Help [F1]; [F]ireballs; Multiple [O]bjects; Between [W]alls only; )
 Float values:
-3 	(WhichMethod [TAB,Q], 0..3)
-1 	(WhichMesh [Home,End], 0..9)
-34 	(Mesh size [Ins,Del], 0..100)
+3 	(WhichMethod [TAB,Q], 0..4)
+7 	(WhichMesh [Home,End], 0..9)
+30 	(Mesh size [Ins,Del], 0..100)
 1 	(Resolution [M], 0..3)
 0 	(ShowCubeMap [C], 0..3)
-50 	(Intensity [+,-], 0..100)
-3 	(shininess [/,*], 0..30)
+45 	(Intensity [+,-], 0..100)
+0 	(shininess [/,*], 0..30)
Index: /GTP/trunk/App/Demos/Illum/EnvMap/EnvMap.fx
===================================================================
--- /GTP/trunk/App/Demos/Illum/EnvMap/EnvMap.fx	(revision 1573)
+++ /GTP/trunk/App/Demos/Illum/EnvMap/EnvMap.fx	(revision 1574)
@@ -462,12 +462,12 @@
 {
 	float d;
-	d = texCUBE(cubemap, L).a;	
-	//d = texCUBE(cubemap, L1).a;	
+	//d = texCUBE(cubemap, L).a;	
+	d = texCUBE(cubemap, L1).a;	
 	L1 = d * normalize(L1);
-	//d = texCUBE(cubemap, L2).a;	
+	d = texCUBE(cubemap, L2).a;	
 	L2 = d * normalize(L2);
-	//d = texCUBE(cubemap, L3).a;	
+	d = texCUBE(cubemap, L3).a;	
 	L3 = d * normalize(L3);
-	//d = texCUBE(cubemap, L4).a;	
+	d = texCUBE(cubemap, L4).a;	
 	L4 = d * normalize(L4);
 		
@@ -477,10 +477,31 @@
     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;	
@@ -734,5 +755,5 @@
 {
     float3 color = objColor * tex2D(DecorationSampler, IN.TexCoord);
-   /* 
+    
     if (iShowCubeMap > 0) 
     {
@@ -749,5 +770,5 @@
 		color *= abs(pow(dot(L,N), 4)) * brightness;
 	}
-	else color *= 0.7;*/
+	else color *= 0.7;
 		
 	float dist = length( IN.Position );
Index: /GTP/trunk/App/Demos/Illum/EnvMap/EnvMap.cpp
===================================================================
--- /GTP/trunk/App/Demos/Illum/EnvMap/EnvMap.cpp	(revision 1573)
+++ /GTP/trunk/App/Demos/Illum/EnvMap/EnvMap.cpp	(revision 1574)
@@ -26,5 +26,5 @@
 #define TEX1	L"Media\\Maps\\pixel-grid-gy.png"
 #define TEX2	L"Media\\Maps\\fire.jpg"		// src: astronomy.swin.edu.au/~pbourke/texture/fire
-#define ROOM_TEXTURE  L"Media\\Maps\\pixel-grid-b_white.png"
+#define ROOM_TEXTURE  L"Media\\Maps\\pixel-grid-b.png"
 
 //--------------------------------------------------------------------------------------
@@ -435,8 +435,8 @@
 	for( int i=0; i<6; i++ )
 	{
-		//objColor = D3DXVECTOR4(0.4f-i*0.1f, i*0.1f, (i%2)*0.4f, 1);		// a colorful room
-		//if (i==3) objColor += D3DXVECTOR4(0.05, 0.05, 0, 1);		
-
-		objColor = facecolors[i];		
+		objColor = D3DXVECTOR4(0.4f-i*0.1f, i*0.1f, (i%2)*0.4f, 1);		// a colorful room
+		if (i==3) objColor += D3DXVECTOR4(0.05, 0.05, 0, 1);		
+
+		//objColor = facecolors[i];		
 
 		g_pEffect->SetVector( "objColor", &objColor );
