sampler2D spriteTex; // normal map sampler2D gLightAccumulation; // screen texture float4x4 wM; float4x4 vP; float4 colour; float2 corners[4]; float2 texCoords[4]; struct vertexOutput { float4 position : POSITION; float2 texCoord : TEXCOORD0; float2 screenCoord : TEXCOORD1; }; vertexOutput spriteVS( float3 position : POSITION) { vertexOutput OUT = (vertexOutput)0; int posIndex = floor(position.z); OUT.position.xy = corners[posIndex].xy; OUT.position.zw = float2(0.f, 1.f); OUT.texCoord = texCoords[posIndex].xy; OUT.position = mul(wM, OUT.position); OUT.position = mul(vP, OUT.position); OUT.screenCoord = (OUT.position.xy * 0.5h) + 0.5h.xx; return OUT; } float4 spritePS( vertexOutput IN ) : COLOR0 { // Get Normal half4 normalBlend = tex2D(spriteTex, IN.texCoord.xy); half3 nM; if(normalBlend.y < 1.0f) discard; nM.xy = normalBlend.zw; nM.xy -= 0.5f.xx; nM.xy *= 2.f.xx; float4 final = tex2D(gLightAccumulation, IN.screenCoord - (nM.xy * colour.a * float2(1.f/1280.f, 1.f/720.f))); return final; } technique loadingScreen < string layer = "GUI" ; > { pass p0 { VertexProgram = compile arbvp1 spriteVS(); FragmentProgram = compile arbfp1 spritePS(); AlphaTestEnable = true; BlendEnable = true; BlendFunc = int2(SrcAlpha, InvSrcAlpha); CullFaceEnable = false; } }