2 // Texture size to calculate texel center
\r
5 // Vertex shader output struct
\r
8 float4 Position : POSITION0;
\r
9 float2 TexCoords : TEXCOORD0;
\r
12 VS_OUTPUT vertexMain(
\r
13 float4 Position : POSITION0,
\r
14 float2 TexCoords : TEXCOORD0
\r
18 OUT.Position = Position;
\r
20 // In practice, instead of passing in TextureSize,
\r
21 // pass 1.0 / TextureSize for better performance
\r
23 // TexCoords is set to the texel center
\r
24 OUT.TexCoords = TexCoords + 1.0 / TextureSize / 2.0;
\r
30 sampler2D TextureSampler;
\r
32 float4 pixelMain ( float2 Texcoords : TEXCOORD0 ) : COLOR0
\r
34 // Texture is sampled at Texcoords using tex2D
\r
35 float4 Color = tex2D(TextureSampler, Texcoords);
\r
37 // Change Texcoords to sample pixels around
\r
39 // Inverse the color to produce negative image effect
\r
40 Color.rgb = 1.0 - Color.rgb;
\r