/////////////////////////////////////////////////////////////////////////////// // // ## ###### // ###### ### // ## ############### Shark 3D Engine (www.shark3d.com) // ########## # # # // ######## Copyright (c) 1996-2006 Spinor GmbH. // ######### # # # All rights reserved. // ## ########## // ## // /////////////////////////////////////////////////////////////////////////////// uniform sampler2D brightTex; uniform vec4 filterInfo; varying vec2 screen; varying vec2 scale; /////////////////////////////////////////////////////////////////////////////// const vec2 offsPix0 = vec2( 1, 0); const vec2 offsPix1 = vec2(-1, 0); const vec2 offsPix2 = vec2( 0, 1); const vec2 offsPix3 = vec2( 0, -1); const vec2 offsPix4 = vec2( 1, 1); const vec2 offsPix5 = vec2(-1, 1); const vec2 offsPix6 = vec2( 1, -1); const vec2 offsPix7 = vec2(-1, -1); /////////////////////////////////////////////////////////////////////////////// void main(void) { // Main depth and color: gl_FragColor = texture2D(brightTex, screen.xy); float full = 2.0 * abs(gl_FragColor.x - 0.5); float treshold = 0.99; float delta = treshold - full; if(delta >= 0.0) { // neightbor texture coordinates: vec2 neigh0 = offsPix0 * scale.xy + screen.xy; vec2 neigh1 = offsPix1 * scale.xy + screen.xy; vec2 neigh2 = offsPix2 * scale.xy + screen.xy; vec2 neigh3 = offsPix3 * scale.xy + screen.xy; vec2 neigh4 = offsPix4 * scale.xy + screen.xy; vec2 neigh5 = offsPix5 * scale.xy + screen.xy; vec2 neigh6 = offsPix6 * scale.xy + screen.xy; vec2 neigh7 = offsPix7 * scale.xy + screen.xy; // Lookup colors: vec4 colA, colB; colA.x = texture2D(brightTex, neigh0).x; colA.y = texture2D(brightTex, neigh1).x; colA.z = texture2D(brightTex, neigh2).x; colA.w = texture2D(brightTex, neigh3).x; colB.x = texture2D(brightTex, neigh4).x; colB.y = texture2D(brightTex, neigh5).x; colB.z = texture2D(brightTex, neigh6).x; colB.w = texture2D(brightTex, neigh7).x; float sum = gl_FragColor.x + dot(colA + colB, vec4(1.0, 1.0, 1.0, 1.0)); gl_FragColor = vec4(sum * 0.11111111); } } ///////////////////////////////////////////////////////////////////////////////