#ifdef GL_ES precision highp int; precision highp float; #endif #define USE_OGRE_FROM_FUTURE #include SAMPLER2D(diffuseMap, 0); OGRE_UNIFORMS( uniform vec4 cutoutColor; uniform float minDistance; uniform float maxDistance; ) MAIN_PARAMETERS IN(vec2 oUv0, TEXCOORD0) MAIN_DECLARATION { vec4 diffuseTex = texture2D(diffuseMap, oUv0); vec4 colorDelta = diffuseTex - cutoutColor; float distance2 = dot(colorDelta, colorDelta); float weight = clamp((distance2 - minDistance) / (maxDistance - minDistance), 0.0, 1.0); gl_FragColor = mix(vec4(diffuseTex.rgb, 0.0), diffuseTex, vec4_splat(weight)); }