Index: /data/Media/materials/programs/Blur0_ps20.hlsl
===================================================================
--- /data/Media/materials/programs/Blur0_ps20.hlsl	(revision 5120)
+++ /data/Media/materials/programs/Blur0_ps20.hlsl	(revision 5120)
@@ -0,0 +1,31 @@
+sampler RT: register(s0);
+// Simple blur filter
+
+float4 main(float2 texCoord: TEXCOORD0) : COLOR {
+
+	float2 samples[12] = {
+   	-0.326212, -0.405805,
+   	-0.840144, -0.073580,
+   	-0.695914,  0.457137,
+   	-0.203345,  0.620716,
+    	0.962340, -0.194983,
+    	0.473434, -0.480026,
+    	0.519456,  0.767022,
+    	0.185461, -0.893124,
+    	0.507431,  0.064425,
+    	0.896420,  0.412458,
+   	-0.321940, -0.932615,
+   	-0.791559, -0.597705,
+	};
+
+   float4 sum = tex2D(RT, texCoord);
+   for (int i = 0; i < 12; i++){
+      sum += tex2D(RT, texCoord + 0.025 * samples[i]);
+   }
+   return sum / 13;
+
+}
+
+
+
+
Index: /data/Media/materials/programs/Blur0_vs.glsl
===================================================================
--- /data/Media/materials/programs/Blur0_vs.glsl	(revision 5120)
+++ /data/Media/materials/programs/Blur0_vs.glsl	(revision 5120)
@@ -0,0 +1,15 @@
+varying vec2 texCoord[5];
+
+void main()                    
+{
+	vec2 inPos = sign(gl_Vertex.xy);
+	gl_Position = vec4(inPos.xy, 0.0, 1.0);
+	
+	texCoord[0]  = (vec2(inPos.x, -inPos.y) + 1.0)/2.0;
+	
+	const float size = 0.01;
+	texCoord[1] = texCoord[0] + vec2(1.0, 0.0)*size;
+	texCoord[2] = texCoord[0] + vec2(2.0, 0.0)*size;
+	texCoord[3] = texCoord[0] + vec2(-1.0, 0.0)*size;
+	texCoord[4] = texCoord[0] + vec2(-2.0, 0.0)*size;
+}
Index: /data/Media/materials/programs/Blur0_vs11.hlsl
===================================================================
--- /data/Media/materials/programs/Blur0_vs11.hlsl	(revision 5120)
+++ /data/Media/materials/programs/Blur0_vs11.hlsl	(revision 5120)
@@ -0,0 +1,22 @@
+struct VS_OUTPUT {
+   float4 Pos: POSITION;
+   float2 texCoord: TEXCOORD0;
+};
+
+VS_OUTPUT main(float4 Pos: POSITION){
+   VS_OUTPUT Out;
+
+   // Clean up inaccuracies
+   Pos.xy = sign(Pos.xy);
+
+   Out.Pos = float4(Pos.xy, 0, 1);
+   // Image-space
+   Out.texCoord.x = 0.5 * (1 + Pos.x);
+   Out.texCoord.y = 0.5 * (1 - Pos.y);
+
+   return Out;
+}
+
+
+
+
Index: /data/Media/materials/programs/Blur1_ps20.hlsl
===================================================================
--- /data/Media/materials/programs/Blur1_ps20.hlsl	(revision 5120)
+++ /data/Media/materials/programs/Blur1_ps20.hlsl	(revision 5120)
@@ -0,0 +1,28 @@
+sampler Blur0: register(s0);
+// Simple blur filter
+
+float4 main(float2 texCoord: TEXCOORD0) : COLOR {
+
+	float2 samples[12] = {
+   	-0.326212, -0.405805,
+   	-0.840144, -0.073580,
+   	-0.695914,  0.457137,
+   	-0.203345,  0.620716,
+    	0.962340, -0.194983,
+    	0.473434, -0.480026,
+    	0.519456,  0.767022,
+    	0.185461, -0.893124,
+    	0.507431,  0.064425,
+    	0.896420,  0.412458,
+   	-0.321940, -0.932615,
+   	-0.791559, -0.597705,
+	};
+
+   float4 sum = tex2D(Blur0, texCoord);
+   for (int i = 0; i < 12; i++){
+      sum += tex2D(Blur0, texCoord + 0.025 * samples[i]);
+   }
+   return sum / 13;
+
+}
+
Index: /data/Media/materials/programs/Blur1_vs.glsl
===================================================================
--- /data/Media/materials/programs/Blur1_vs.glsl	(revision 5120)
+++ /data/Media/materials/programs/Blur1_vs.glsl	(revision 5120)
@@ -0,0 +1,15 @@
+varying vec2 texCoord[5];
+
+void main()                    
+{
+	vec2 inPos = sign(gl_Vertex.xy);
+	gl_Position = vec4(inPos.xy, 0.0, 1.0);
+	
+	texCoord[0]  = (vec2(inPos.x, -inPos.y) + 1.0)/2.0;
+	
+	const float size = 0.01;
+	texCoord[1] = texCoord[0] + vec2(0.0, 1.0)*size;
+	texCoord[2] = texCoord[0] + vec2(0.0, 2.0)*size;
+	texCoord[3] = texCoord[0] + vec2(0.0, -1.0)*size;
+	texCoord[4] = texCoord[0] + vec2(0.0, -2.0)*size;
+}
Index: /data/Media/materials/programs/Blur1_vs11.hlsl
===================================================================
--- /data/Media/materials/programs/Blur1_vs11.hlsl	(revision 5120)
+++ /data/Media/materials/programs/Blur1_vs11.hlsl	(revision 5120)
@@ -0,0 +1,19 @@
+struct VS_OUTPUT {
+   float4 Pos: POSITION;
+   float2 texCoord: TEXCOORD0;
+};
+
+VS_OUTPUT main(float4 Pos: POSITION){
+   VS_OUTPUT Out;
+
+   // Clean up inaccuracies
+   Pos.xy = sign(Pos.xy);
+
+   Out.Pos = float4(Pos.xy, 0, 1);
+   // Image-space
+   Out.texCoord.x = 0.5 * (1 + Pos.x);
+   Out.texCoord.y = 0.5 * (1 - Pos.y);
+
+   return Out;
+}
+
Index: /data/Media/materials/programs/Blur_ps.glsl
===================================================================
--- /data/Media/materials/programs/Blur_ps.glsl	(revision 5120)
+++ /data/Media/materials/programs/Blur_ps.glsl	(revision 5120)
@@ -0,0 +1,14 @@
+uniform sampler2D tex0;
+
+varying vec2 texCoord[5];
+
+void main()
+{
+	vec4 sum = texture2D(tex0, texCoord[0]) + 
+			   texture2D(tex0, texCoord[1]) +
+			   texture2D(tex0, texCoord[2]) + 
+			   texture2D(tex0, texCoord[3]) +
+			   texture2D(tex0, texCoord[4]);
+	gl_FragColor = sum / 5.0;
+}
+
Index: /data/Media/materials/programs/BumpMapping.cg
===================================================================
--- /data/Media/materials/programs/BumpMapping.cg	(revision 5120)
+++ /data/Media/materials/programs/BumpMapping.cg	(revision 5120)
@@ -0,0 +1,152 @@
+// General functions
+
+// Expand a range-compressed vector
+float3 expand(float3 v)
+{
+	return (v - 0.5) * 2;
+}
+
+
+/* Bump mapping vertex program
+   In this program, we want to calculate the tangent space light vector
+   on a per-vertex level which will get passed to the fragment program,
+   or to the fixed function dot3 operation, to produce the per-pixel
+   lighting effect.
+*/
+void main_vp(float4 position	: POSITION,
+			 float3 normal		: NORMAL,
+			 float2 uv			: TEXCOORD0,
+			 float3 tangent     : TANGENT0,
+			 // outputs
+			 out float4 oPosition    : POSITION,
+			 out float2 oUv			 : TEXCOORD0,
+			 out float3 oTSLightDir	 : TEXCOORD1,
+			 // parameters
+			 uniform float4 lightPosition, // object space
+			 uniform float4x4 worldViewProj)
+{
+	// calculate output position
+	oPosition = mul(worldViewProj, position);
+
+	// pass the main uvs straight through unchanged
+	oUv = uv;
+
+	// calculate tangent space light vector
+	// Get object space light direction
+	// Non-normalised since we'll do that in the fragment program anyway
+	float3 lightDir = lightPosition.xyz -  (position * lightPosition.w);
+
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+	// NB looks like nvidia cross params are BACKWARDS to what you'd expect
+	// this equates to NxT, not TxN
+	float3 binormal = cross(tangent, normal);
+
+	// Form a rotation matrix out of the vectors
+	float3x3 rotation = float3x3(tangent, binormal, normal);
+
+	// Transform the light vector according to this matrix
+	oTSLightDir = mul(rotation, lightDir);
+
+
+}
+
+void main_fp( float2 uv			: TEXCOORD0,
+			  float3 TSlightDir : TEXCOORD1,
+
+			  out float4 colour	: COLOR,
+
+			  uniform float4 lightDiffuse,
+			  uniform sampler2D   normalMap : register(s0),
+			  uniform samplerCUBE normalCubeMap : register(s1) )
+{
+	// retrieve normalised light vector, expand from range-compressed
+	float3 lightVec = expand(texCUBE(normalCubeMap, TSlightDir).xyz);
+
+	// get bump map vector, again expand from range-compressed
+	float3 bumpVec = expand(tex2D(normalMap, uv).xyz);
+
+	// Calculate dot product
+	colour = lightDiffuse * dot(bumpVec, lightVec);
+
+}
+
+/* Vertex program which includes specular component */
+void specular_vp(float4 position	: POSITION,
+			 	 float3 normal		: NORMAL,
+			 	 float2 uv			: TEXCOORD0,
+			 	 float3 tangent     : TANGENT0,
+			 	 // outputs
+			 	 out float4 oPosition    : POSITION,
+			 	 out float2 oUv			 : TEXCOORD0,
+			 	 out float3 oTSLightDir	 : TEXCOORD1,
+				 out float3 oTSHalfAngle : TEXCOORD2,
+			 	 // parameters
+				 uniform float4 lightPosition, // object space
+			 	 uniform float3 eyePosition,   // object space
+			 	 uniform float4x4 worldViewProj)
+{
+	// calculate output position
+	oPosition = mul(worldViewProj, position);
+
+	// pass the main uvs straight through unchanged
+	oUv = uv;
+
+	// calculate tangent space light vector
+	// Get object space light direction
+	float3 lightDir = normalize(lightPosition.xyz -  (position * lightPosition.w));
+
+	// Calculate the binormal (NB we assume both normal and tangent are
+	// already normalised)
+	// NB looks like nvidia cross params are BACKWARDS to what you'd expect
+	// this equates to NxT, not TxN
+	float3 binormal = cross(tangent, normal);
+
+	// Form a rotation matrix out of the vectors
+	float3x3 rotation = float3x3(tangent, binormal, normal);
+
+	// Transform the light vector according to this matrix
+	oTSLightDir = mul(rotation, lightDir);
+
+	// Calculate half-angle in tangent space
+	float3 eyeDir = normalize(eyePosition - position.xyz);
+	float3 halfAngle = normalize(eyeDir + lightDir);
+	oTSHalfAngle = mul(rotation, halfAngle);
+
+
+}
+
+/* Fragment program which supports specular component */
+void specular_fp( float2 uv			: TEXCOORD0,
+			  float3 TSlightDir : TEXCOORD1,
+			  float3 TShalfAngle: TEXCOORD2,
+
+			  out float4 colour	: COLOR,
+
+			  uniform float4 lightDiffuse,
+			  uniform float4 lightSpecular,
+			  uniform float shine,
+			  uniform sampler2D   normalMap : register(s0),
+			  uniform samplerCUBE normalCubeMap : register(s1),
+			  uniform samplerCUBE normalCubeMap2 : register(s2)) // we need this second binding to be compatible with ps_1_1, ps_2_0 could reuse the other
+{
+	// retrieve normalised light vector, expand from range-compressed
+	float3 lightVec = expand(texCUBE(normalCubeMap, TSlightDir).xyz);
+
+	// retrieve half angle and normalise through cube map
+	float3 halfAngle = expand(texCUBE(normalCubeMap2, TShalfAngle).xyz);
+
+	// get bump map vector, again expand from range-compressed
+	float3 bumpVec = expand(tex2D(normalMap, uv).xyz);
+
+
+	float specFactor = pow(dot(bumpVec, halfAngle),shine);
+
+
+
+	// Calculate dot product for diffuse
+	colour = (lightDiffuse * saturate(dot(bumpVec, lightVec))) +
+			(lightSpecular * specFactor);
+
+}
+
Index: /data/Media/materials/programs/Combine_fp.cg
===================================================================
--- /data/Media/materials/programs/Combine_fp.cg	(revision 5120)
+++ /data/Media/materials/programs/Combine_fp.cg	(revision 5120)
@@ -0,0 +1,15 @@
+float4 Combine_fp
+(
+    in float2 texCoord: TEXCOORD0,
+    
+    uniform sampler RT : register(s0),
+    uniform sampler Sum : register(s1),
+
+    uniform float blur
+) : COLOR
+{
+   float4 render = tex2D(RT, texCoord);
+   float4 sum = tex2D(Sum, texCoord);
+
+   return lerp(render, sum, blur);
+}
Index: /data/Media/materials/programs/StdQuad_vp.cg
===================================================================
--- /data/Media/materials/programs/StdQuad_vp.cg	(revision 5120)
+++ /data/Media/materials/programs/StdQuad_vp.cg	(revision 5120)
@@ -0,0 +1,113 @@
+void StdQuad_vp
+(
+    in float4 inPos : POSITION,
+
+    out float4 pos : POSITION,
+    out float2 uv0 : TEXCOORD0,
+
+    uniform float4x4 worldViewProj
+)
+{
+    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    pos = mul(worldViewProj, inPos);
+
+    // The input positions adjusted by texel offsets, so clean up inaccuracies
+    inPos.xy = sign(inPos.xy);
+
+    // Convert to image-space
+    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
+}
+
+void StdQuad_Tex2_vp
+(
+    in float4 inPos : POSITION,
+
+    out float4 pos : POSITION,
+    out float2 uv0 : TEXCOORD0,
+    out float2 uv1 : TEXCOORD1,
+
+    uniform float4x4 worldViewProj
+)
+{
+    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    pos = mul(worldViewProj, inPos);
+
+    // The input positions adjusted by texel offsets, so clean up inaccuracies
+    inPos.xy = sign(inPos.xy);
+
+    // Convert to image-space
+    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
+    uv1 = uv0;
+}
+
+void StdQuad_Tex2a_vp
+(
+    in float4 inPos : POSITION,
+
+    out float4 pos : POSITION,
+    out float2 uv0 : TEXCOORD0,
+    out float2 uv1 : TEXCOORD1,
+
+    uniform float4x4 worldViewProj
+)
+{
+    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    pos = mul(worldViewProj, inPos);
+
+    // The input positions adjusted by texel offsets, so clean up inaccuracies
+    inPos.xy = sign(inPos.xy);
+
+    // Convert to image-space
+    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
+    uv1 = inPos.xy;
+}
+
+void StdQuad_Tex3_vp
+(
+    in float4 inPos : POSITION,
+
+    out float4 pos : POSITION,
+    out float2 uv0 : TEXCOORD0,
+    out float2 uv1 : TEXCOORD1,
+    out float2 uv2 : TEXCOORD2,
+
+    uniform float4x4 worldViewProj
+)
+{
+    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    pos = mul(worldViewProj, inPos);
+
+    // The input positions adjusted by texel offsets, so clean up inaccuracies
+    inPos.xy = sign(inPos.xy);
+
+    // Convert to image-space
+    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
+    uv1 = uv0;
+    uv2 = uv0;
+}
+
+void StdQuad_Tex4_vp
+(
+    in float4 inPos : POSITION,
+
+    out float4 pos : POSITION,
+    out float2 uv0 : TEXCOORD0,
+    out float2 uv1 : TEXCOORD1,
+    out float2 uv2 : TEXCOORD2,
+    out float2 uv3 : TEXCOORD3,
+
+    uniform float4x4 worldViewProj
+)
+{
+    // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
+    pos = mul(worldViewProj, inPos);
+
+    // The input positions adjusted by texel offsets, so clean up inaccuracies
+    inPos.xy = sign(inPos.xy);
+
+    // Convert to image-space
+    uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
+    uv1 = uv0;
+    uv2 = uv0;
+    uv3 = uv0;
+}
Index: /data/Media/materials/programs/StdQuad_vp.glsl
===================================================================
--- /data/Media/materials/programs/StdQuad_vp.glsl	(revision 5120)
+++ /data/Media/materials/programs/StdQuad_vp.glsl	(revision 5120)
@@ -0,0 +1,11 @@
+varying vec2 uv;
+
+void main()                    
+{
+	gl_Position = ftransform();
+	
+	vec2 inPos = sign(gl_Vertex.xy);
+	
+	uv = (vec2(inPos.x, -inPos.y) + 1.0)/2.0;
+}
+
