Colored Dropshadow

This forum is currently in read-only mode.
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • Hey guys,

    Could someone please edit the dropshadow shader below to use rgb colors instead of just a black shadow? I don't have knowledge of shader code to do it myself. Thank you.

    // Dropshadow blurred
    // David Clark (edited by Louis Ferina, Jorge Fuente-Alba)
    // PS 2.0
    
    //#CROSS-SAMPLING : reads pixels it may be writing.
    //#BORDER-MODE : samples pixels outside bounding box
    //#PARAM float offsetX 5.0 : X Offset: X offset of dropshadow.
    //#PARAM float offsetY 5.0 : Y Offset: Y offset of dropshadow.
    //#PARAM float blur 2.5 : Blur : Blur amount of dropshadow.
    //#PARAM float opacity 0.5 : Opacity : Opacity of dropshadow.
    
    // Foreground texture
    texture ForegroundTexture;
    
    // Foreground sampler
    sampler2D foreground = sampler_state {
    Texture = (ForegroundTexture);
    MinFilter = Point;
    MagFilter = Point;
    MipFilter = Point;
    };
    
    // Parameter variables
    float offsetX;
    float offsetY;
    float pixelWidth;
    float pixelHeight;
    float blur;
    float opacity;
    
    // Effect function
    float4 EffectProcess( float2 Tex : TEXCOORD0 ) : COLOR0
    {
    // Add the front and back pixels
    float2 Tex2 = Tex;
    Tex2.x -= offsetX * pixelWidth;
    Tex2.y -= offsetY * pixelHeight;
    float4 here = tex2D(foreground, Tex2.xy)*0.25;
    float4 left = tex2D(foreground, float2(Tex2.x - (pixelWidth*blur), Tex2.y))*0.1875;
    float4 right = tex2D(foreground, float2(Tex2.x + (pixelWidth*blur), Tex2.y))*0.1875;
    float4 top = tex2D(foreground, float2(Tex2.x, Tex2.y - (pixelHeight*blur)))*0.1875;
    float4 bottom = tex2D(foreground, float2(Tex2.x, Tex2.y + (pixelHeight*blur)))*0.1875;
    
    float4 result = (here + left + right + top + bottom )* opacity;
    float4 src = tex2D(foreground, Tex.xy);
    
    result.rgb = 0;
    
    return result * (1-src.a) + src;
    
    }
    
    // ConstructEffect
    technique ConstructEffect
    {
    pass p0
    {
    VertexShader = null;
    PixelShader = compile ps_2_0 EffectProcess();
    }
    }
    
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)