#ifdef GL_ES precision mediump int; precision mediump float; #endif #define USE_OGRE_FROM_FUTURE #include SAMPLER2D(RT, 0); OGRE_UNIFORMS( uniform float scale; uniform float pixelSize; ) MAIN_PARAMETERS IN(vec2 oUv0, TEXCOORD0) MAIN_DECLARATION { vec2 samples[4]; samples[0] = vec2(0, -1); samples[1] = vec2(-1, 0); samples[2] = vec2(1, 0); samples[3] = vec2(0, 1); vec4 tc = texture2D(RT, oUv0); vec4 laplace = vec4_splat(-4.0) * tc; // Sample the neighbor pixels for (int i = 0; i < 4; i++){ laplace += texture2D(RT, oUv0 + vec2_splat(pixelSize) * samples[i]); } gl_FragColor = vec4_splat(1.0) - (vec4_splat(0.5 + scale) * laplace); }