Shaders are cut off on edges

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jarlowrey

If I add a shader to my Sprite, it will only extend to the limits of the Sprite. How can I ensure it won’t be cut off?


enter image description here


I have tried adding the shader to a parent node, and setting the shader texture to the Sprite’s texture. Like this:




uniform sampler2D tex;

void fragment()
    vec4 tcol = texture(tex, UV);

    if (tcol.a == 0.0)
        if (texture(tex, UV + vec2(0.0,          outLineSize)).a  != 0.0 ||

But then nothing appears. It doesn’t look like the texture is being passed in correctly.

:bust_in_silhouette: Reply From: Diet Estus

Perhaps you can make your sprite a child of some larger parent node (and center it) and then add the shader material to the parent.

I was thinking the same, but am not sure how I would access the Sprite texture within the larger node’s shader.

jarlowrey | 2018-04-18 18:09