#include "HDRBloom.cgfx" half blurMagnitude; //half nearLimit; //half farLimit; //half maxDensity; half3 inverseOffset; half3 inverseScale; half4 inverseParams; sampler2D screenTexture; sampler2D fullyBlurredImage; sampler2D depthTexture; sampler2D flareTexture; #include "DepthOfField.cgfx" // Vertex Shader Output Structure struct vertexOutput { half4 position : POSITION; half2 texCoord : TEXCOORD0; }; // Vertex Shader // Simply passes the position and texture coords through vertexOutput postprocessBloomVP( half4 position : POSITION, half2 texCoord : TEXCOORD0 ) { vertexOutput OUT = (vertexOutput)0; OUT.position = position; OUT.texCoord = texCoord; return OUT; } // Pixel Shader // Uses the function 'ProcessBloom', and outputs the result half4 postprocessBloomFP( vertexOutput IN) : COLOR0 { half4 screenColour = h4tex2D(screenTexture, IN.texCoord); screenColour = screenColour/screenColour.a; //// BLOOM ///// half4 BloomResult; BloomResult.rgb = ProcessBloom(IN.texCoord, screenColour.rgb, fullyBlurredImage); BloomResult.a = 1.h - blurMagnitude; BloomResult = saturate(BloomResult); //// CORONAS and FLARES //// half4 corona; corona += h4tex2D(flareTexture, IN.texCoord); corona *= 0.25h; // Divide by 4 because the 4 spokes in the star are added together BloomResult += corona; return BloomResult; } // Technique for Bloom technique postprocessBloom { pass p0 { VertexProgram = compile vp30 postprocessBloomVP(); FragmentProgram = compile fp40 postprocessBloomFP(); DepthTestEnable = false; DepthMask = false; BlendEnable = false; } }