string description = "Basic Shadow Material"; /************* UN-TWEAKABLES **************/ /*********** Tweakables **********************/ /************* Textures ******************/ sampler2D normalTexture; #include "../Basic_Utils.cgfx"; /************* DATA STRUCTS **************/ /* data from application vertex buffer */ struct appdata { float4 position : POSITION; float2 texCoord : TEXCOORD0; }; /* data passed from vertex shader to pixel shader */ struct vertexOutput { float4 position : POSITION; float2 texCoord : TEXCOORD0; }; /*********** vertex program ******/ vertexOutput simpleVP(appdata IN) { vertexOutput OUT = (vertexOutput)0; OUT.position = IN.position; OUT.texCoord = IN.texCoord; return OUT; } /********* fragment program ********/ void simpleFP(vertexOutput IN, out float4 colour : COLOR0) { float4 nm = tex2D(normalTexture, IN.texCoord); colour = float4(DecodeNormal(nm.rg), 1.f); colour.b *= -sign(nm.a); } /*************/ technique basic { pass p0 { VertexProgram = compile vp30 simpleVP(); FragmentProgram = compile fp30 simpleFP(); DepthTestEnable = false; DepthMask = false; } } /***************************** eof ***/