/////////////////////////////////////////////////////////////////////////////// // // ## ###### // ###### ### // ## ############### Shark 3D Engine (www.shark3d.com) // ########## # # # // ######## Copyright (c) 1996-2006 Spinor GmbH. // ######### # # # All rights reserved. // ## ########## // ## // /////////////////////////////////////////////////////////////////////////////// struct PS_INPUT { float2 screen: TEXCOORD0; float2 scale: TEXCOORD1; }; /////////////////////////////////////////////////////////////////////////////// sampler brightTex: register(s0); /////////////////////////////////////////////////////////////////////////////// const float2 offsPix0 = float2( 1, 0); const float2 offsPix1 = float2( 0, 1); const float2 offsPix2 = float2( 1, 1); const float2 offsPix3 = float2(-1, 1); /////////////////////////////////////////////////////////////////////////////// // Pixelshader // Profile: 2x0 float4 main(PS_INPUT input): COLOR0 { // Main color: float4 result = tex2D(brightTex, input.screen.xy); float full = abs(2 * result.x - 1); float treshold = 0.99; float delta = treshold - full; if(delta >= 0) { // Lookup colors: float4 colA, colB; float2 offs0 = offsPix0 * input.scale.xy; colA.x = tex2D(brightTex, input.screen.xy + offs0).x; colB.x = tex2D(brightTex, input.screen.xy - offs0).x; float2 offs1 = offsPix1 * input.scale.xy; colA.y = tex2D(brightTex, input.screen.xy + offs1).x; colB.y = tex2D(brightTex, input.screen.xy - offs1).x; float2 offs2 = offsPix2 * input.scale.xy; colA.z = tex2D(brightTex, input.screen.xy + offs2).x; colB.z = tex2D(brightTex, input.screen.xy - offs2).x; float2 offs3 = offsPix3 * input.scale.xy; colA.w = tex2D(brightTex, input.screen.xy + offs3).x; colB.w = tex2D(brightTex, input.screen.xy - offs3).x; // Calculate average: float sum = result.x + dot(colA + colB, float4(1, 1, 1, 1)); result.xyz = sum * 0.11111111; } return result; } ///////////////////////////////////////////////////////////////////////////////