Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/troll.material
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/troll.material	(revision 2376)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/troll.material	(revision 2386)
@@ -1,53 +1,5 @@
-material phong22
-{
-	technique
-	{
-		pass
-		{
-			texture_unit
-			{
-				texture eyeball.jpg
-				tex_coord_set 0
-				colour_op modulate
-			}
-		}
-	}
-}
-material phong44
-{
-	technique
-	{
-		pass
-		{
-
-			texture_unit
-			{
-				texture trollbody.png
-				tex_coord_set 0
-				colour_op modulate
-			}
-		}
-	}
-}
-material phong11
-{
-	technique
-	{
-		pass
-		{
-
-			texture_unit
-			{
-				texture trollhead.png
-				tex_coord_set 0
-				colour_op modulate
-			}
-		}
-	}
-}
-
 vertex_program TrollSkinningOneWeight cg
 {
-   source trollvs.hlsl
+   source trollvs.cg
    entry_point trollSkinning_One_Weight_vp
    profiles vs_2_0
@@ -57,8 +9,15 @@
 vertex_program TrollSkinningSMGen cg
 {
-   source trollvs.hlsl
+   source trollvs.cg
    entry_point trollSkinning_SMGen_One_Weight_vp
    profiles vs_2_0
    includes_skeletal_animation true   
+}
+
+fragment_program TrollPS hlsl
+{
+   source trollps.hlsl
+   entry_point Troll_PS
+   target ps_2_0
 }
 
@@ -122,12 +81,19 @@
 				param_named_auto worldMatrix3x4Array[0] world_matrix_array_3x4
 				param_named_auto viewProjectionMatrix viewproj_matrix
-				param_named_auto lightPos[0] light_position 0
-				param_named_auto lightPos[1] light_position 1
-				param_named_auto lightDiffuseColour[0] light_diffuse_colour 0
-				param_named_auto lightDiffuseColour[1] light_diffuse_colour 1
-				param_named_auto ambient ambient_light_colour
-			
+				param_named_auto lightPos light_position 0
+				param_named_auto cameraPos camera_position		
+			}
+			fragment_program_ref TrollPS
+			{
+				param_named_auto lightRange light_attenuation 0
+   			    param_named_auto lightPower light_power 0
+   			    param_named_auto lightColor light_diffuse_colour 0
+   			    param_named specularity float 1
+   			    param_named specularColor float4 0.02 0.02 0.02 0.02   			
 			}
 			texture_unit basetexture
+			{
+			}
+			texture_unit bumptexture
 			{
 			}
@@ -144,6 +110,4 @@
 			{
 				texture eyeball.jpg
-				tex_coord_set 0
-				colour_op modulate
 			}
 		}
@@ -159,6 +123,8 @@
 			{
 				texture trollbody.png
-				tex_coord_set 0
-				colour_op modulate
+			}
+			texture_unit bumptexture
+			{
+				texture trollbodybump.png
 			}
 		}
@@ -174,6 +140,8 @@
 			{
 				texture trollhead.png
-				tex_coord_set 0
-				colour_op modulate
+			}
+			texture_unit bumptexture
+			{
+				texture trollheadbump.png
 			}
 		}
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollps.hlsl
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollps.hlsl	(revision 2386)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollps.hlsl	(revision 2386)
@@ -0,0 +1,43 @@
+#define MAX_LIGHT 2
+#define MAX_CAU_CASTER 2
+#define SPOT_ANGLE 2.093
+#define SPOT_FALLOFF 1
+#define SHADOW_COLOR float4(0.3,0.3,0.3,1.0)
+#define SHADOW_BIAS_POINT 0.0001
+#define SHADOW_EPSILON_POINT 0.0001
+
+uniform sampler2D colorTexture : register(s0);
+uniform sampler2D bumpMap : register(s1);
+
+uniform float4 lightRange;
+uniform float lightPower;
+uniform float4 lightColor;
+
+uniform float specularity;
+uniform float4 specularColor;
+
+#include "illum.hlsl"
+
+struct Troll_PS_IN
+{
+	float2 texCoord:TEXCOORD0;
+	float3 tangent:TEXCOORD1;
+	float3 binormal:TEXCOORD2;
+	float3 normal:TEXCOORD3;
+	float3 V: TEXCOORD4;
+	float3 L: TEXCOORD5;
+};
+
+float4 Troll_PS(Troll_PS_IN IN):COLOR
+{
+	float4 Color = 0;
+	float3 N = NormalMap(IN.tangent, IN.binormal, IN.normal, IN.texCoord, bumpMap);
+	float3 V = normalize(IN.V);
+	float3 L = IN.L;
+	
+	float4 diffuseColor = tex2D(colorTexture, IN.texCoord);
+	
+	Color = Illumination(N, L, V, lightColor * lightPower, lightRange, diffuseColor, specularity, specularColor);
+	
+	return diffuseColor * 0.1 + Color;
+}
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material	(revision 2376)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/moria.material	(revision 2386)
@@ -45,4 +45,5 @@
    			  param_named_auto wCamPos camera_position
    			  param_named normalCoord float 0
+   			  param_named texture_repeat float 1
    			}
   			fragment_program_ref GTP/MoriaDemo/MoriaHallBase_PS
@@ -117,4 +118,5 @@
    			{
    				param_named normalCoord float 1
+   				param_named texture_repeat float 3
    			}
 			
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl	(revision 2376)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/MoriaHallBase.hlsl	(revision 2386)
@@ -62,8 +62,10 @@
 										float2 atlasTex  : TEXCOORD2,
 										float3 tangent   : TEXCOORD3,
-										uniform float normalCoord)
+										uniform float normalCoord,
+										uniform float texture_repeat)
 {
 	MORIA_HALL_BASE_VSOUT OUT = (MORIA_HALL_BASE_VSOUT) 0;
 	
+	texCoord2.xy *= texture_repeat;
 	OUT.texCoord = float4(texCoord1.xy, texCoord2.xy);	
 	if(normalCoord == 0)
Index: /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollvs.cg
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollvs.cg	(revision 2386)
+++ /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollvs.cg	(revision 2386)
@@ -0,0 +1,54 @@
+
+void trollSkinning_One_Weight_vp(
+	float4 position : POSITION,
+	float3 normal   : NORMAL,
+	float2 uv       : TEXCOORD0,
+	float3 tangent  : TANGENT,
+	float  blendIdx : BLENDINDICES,
+	out float4 oPosition : POSITION,
+	out float2 oUv       : TEXCOORD0,
+	out float3 oTangent: TEXCOORD1,
+	out float3 oBinormal: TEXCOORD2,
+	out float3 oNormal   : TEXCOORD3,
+	out float3 V: TEXCOORD4,
+	out float3 L: TEXCOORD5,
+	uniform float3x4   worldMatrix3x4Array[67],
+	uniform float4x4 viewProjectionMatrix,
+	uniform float4   lightPos,
+	uniform float4   cameraPos)
+{
+	// transform by indexed matrix
+	float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
+	// view / projection
+	oPosition = mul(viewProjectionMatrix, blendPos);
+	// transform normal
+	oNormal = mul((float3x3)worldMatrix3x4Array[blendIdx], normal);
+	oTangent = mul((float3x3)worldMatrix3x4Array[blendIdx], tangent);
+	oNormal = normalize(oNormal);
+	oTangent = normalize(oTangent);
+	oBinormal = cross(oTangent, oNormal);
+	// Lighting - support point and directional
+	L =  lightPos.xyz - blendPos.xyz * lightPos.w;
+	V =  cameraPos.xyz - blendPos.xyz;
+	
+	oUv = uv;	
+}	
+
+
+void trollSkinning_SMGen_One_Weight_vp(
+	float4 position : POSITION,
+	float  blendIdx : BLENDINDICES,
+	out float4 oPosition : POSITION,
+	out float3 cPos:TEXCOORD0,	
+	// Support up to 24 bones of float3x4
+	// vs_1_1 only supports 96 params so more than this is not feasible
+	uniform float3x4   worldMatrix3x4Array[67],
+	uniform float4x4 viewMatrix,
+	uniform float4x4 viewProjectionMatrix)
+{
+	// transform by indexed matrix
+	float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
+	// view / projection
+	cPos = mul(viewMatrix, blendPos).xyz;
+	oPosition = mul(viewProjectionMatrix, blendPos);	
+}	
Index: P/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollvs.hlsl
===================================================================
--- /GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/trollvs.hlsl	(revision 2368)
+++ 	(revision )
@@ -1,52 +1,0 @@
-void trollSkinning_One_Weight_vp(
-	float4 position : POSITION,
-	float3 normal   : NORMAL,
-	float2 uv       : TEXCOORD0,
-	float  blendIdx : BLENDINDICES,
-	out float4 oPosition : POSITION,
-	out float2 oUv       : TEXCOORD0,
-	out float4 colour           : COLOR,
-	uniform float3x4   worldMatrix3x4Array[67],
-	uniform float4x4 viewProjectionMatrix,
-	uniform float4   lightPos[2],
-	uniform float4   lightDiffuseColour[2],
-	uniform float4   ambient)
-{
-	// transform by indexed matrix
-	float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
-	// view / projection
-	oPosition = mul(viewProjectionMatrix, blendPos);
-	// transform normal
-	float3 norm = mul((float3x3)worldMatrix3x4Array[blendIdx], normal);
-	// Lighting - support point and directional
-	float3 lightDir0 = 	normalize(
-		lightPos[0].xyz -  (blendPos.xyz * lightPos[0].w));
-	float3 lightDir1 = 	normalize(
-		lightPos[1].xyz -  (blendPos.xyz * lightPos[1].w));
-
-	oUv = uv;
-	colour = ambient + 
-		(saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) 
-	//	+(saturate(dot(lightDir1, norm)) * lightDiffuseColour[1])
-	;
-	
-}	
-
-
-void trollSkinning_SMGen_One_Weight_vp(
-	float4 position : POSITION,
-	float  blendIdx : BLENDINDICES,
-	out float4 oPosition : POSITION,
-	out float3 cPos:TEXCOORD0,	
-	// Support up to 24 bones of float3x4
-	// vs_1_1 only supports 96 params so more than this is not feasible
-	uniform float3x4   worldMatrix3x4Array[67],
-	uniform float4x4 viewMatrix,
-	uniform float4x4 viewProjectionMatrix)
-{
-	// transform by indexed matrix
-	float4 blendPos = float4(mul(worldMatrix3x4Array[blendIdx], position).xyz, 1.0);
-	// view / projection
-	cPos = mul(viewMatrix, blendPos).xyz;
-	oPosition = mul(viewProjectionMatrix, blendPos);	
-}	
