Sprite Outline via Shader - showcase & looking for improvements

q1:
#extension GL_OES_standard_derivatives : enable
then
replace your magic 0.001 with dFdx(outTexCoord) dFdy(outTexCoord)
BTW:
gl_FragColor = color.a * colurU.a * colorD.a * ..... colorR.a == 0. ? color : vec4(1., 0., 0., .2);
ternery condition is faster then IF.

q2:
suggest that use 3.17.0, there is native Shader gameobject to use, so no need to deal with the renderer.

q3:
texturepacker provides such functionality for you, why not use it? shader is still a resource we need to save… :slight_smile: if you mean your texture is an atlas, then
outTexCoord *= frameSize / resolution
outTexCoord += framePosition / resolution

q4:
of course, OpenGL even renders gaps if you donot pad some transparent pixels between image blocks.

q5:
another topic though…

3 Likes