#include "HDRBloom.cgfx" // Vertex Shader Output Structure struct vertexOutput { float4 oPosition : POSITION; float2 oTexCoord : TEXCOORD0; }; // Vertex Shader // Simply passes the position and texture coords through vertexOutput postprocessBloomVP( float4 position : POSITION, float2 texCoord : TEXCOORD0 ) { vertexOutput OUT = (vertexOutput)0; OUT.oPosition = position; OUT.oTexCoord = texCoord; return OUT; } // Pixel Shader // Uses the function 'ProcessBloom', and outputs the result float4 postprocessBloomFP( vertexOutput IN, uniform float blurMagnitude, uniform sampler2D screenTexture, uniform sampler2D fullyBlurredImage ) : COLOR0 { float4 screenColour = tex2D(screenTexture, IN.oTexCoord); float4 BloomResult = ProcessBloom(IN.oTexCoord, screenColour, fullyBlurredImage); BloomResult.a = 1.f - blurMagnitude; BloomResult = clamp(BloomResult, 0.f, 1.f); return BloomResult; } // Technique for Bloom technique postprocessBloom { pass p0 { VertexProgram = compile vp30 postprocessBloomVP(); FragmentProgram = compile fp40 postprocessBloomFP(); DepthTestEnable = false; DepthMask = false; BlendEnable = true; } }