<div>Hi Alexandros,</div><div><br></div><div>I have reasons to believe the skeletal fragment shader below is more-or-less what you've been looking for. Please note it has been tuned for emulating GL_CLAMP_TO_BORDER with bilinear only, and as such it has certain requirements for the TMU setup:</div>
<div><br></div><div><div> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);</div><div> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);</div><div> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);</div>
<div> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);</div></div><div><br></div><div><br></div><div>Also, I've left some things, which would naturally enter as uniforms, as constants here, to underline how those expressions can be done host-side. And oh, the border color is implied black : )</div>
<div><br></div><div> varying vec2 tc_i; // texcoord interpolant, pardon my archaic naming convention</div><div> </div><div> uniform sampler2D albedo;</div><div> </div>
<div> const vec2 dim = vec2(4.0);</div>
<div> const vec2 edge = vec2(0.5) - vec2(0.5) / dim;</div><div> const vec2 bord = vec2(0.5) + vec2(0.5) / dim;</div><div> </div><div> void main()</div>
<div> {</div><div> vec2 fade = vec2(1.0);</div><div> vec2 tc_d = abs(tc_i - 0.5);</div><div> </div>
<div> if (tc_d.x > edge.x)</div><div> fade.x = (bord.x - tc_d.x) * dim.x;</div><div> </div><div> if (tc_d.y > edge.y)</div>
<div> fade.y = (bord.y - tc_d.y) * dim.y;</div><div> </div><div> fade = clamp(fade, 0.0, 1.0);</div><div> gl_FragColor = texture2D(albedo, tc_i) * fade.x * fade.y;</div>
<div> }</div><div><br></div><div><br></div><div>Best regards,</div><div>martin</div><div><br></div><div>ps: Judging by your postings on the subject, I think you were getting to that solution yourself.</div>