【Defold】Sprite用 Glow シェーダー

Defold, DEVELOP

Defold 用の Sprite Glowシェーダーです。

varying mediump vec2 var_texcoord0;
 
uniform lowp sampler2D texture_sampler;
uniform lowp vec4 tint;
uniform lowp vec4 _GlowColor;
uniform lowp vec4 _GlowIntensity;
 
void main()
{
    lowp vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w);
    lowp vec4 col = texture2D(texture_sampler, var_texcoord0.xy) * tint_pm;
 
    lowp vec4 emission;
    emission = col;
 
    emission.xyz *= emission.w * col.w * _GlowIntensity.w * _GlowColor;
    col.xyz += emission.xyz;
     
    gl_FragColor = col;
}

Posted by kazupon