Help!? FX not quite working as expected

0 favourites
  • 1 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello,

    I am just getting into writing shaders and I really can't seem to figure out why this doesn't work... (I'm sure some of you may notice it is a modification of setcolor fx bundled with construct 2)

    All I want to do is invert the alpha without messing with anything else, but that's not what happens. It works fine on one object but when you layer the objects or have different colored backgrounds it stops working:


    // Flip Alpha effect

    varying mediump vec2 vTex;

    uniform lowp sampler2D samplerFront;

    uniform lowp float red;

    uniform lowp float green;

    uniform lowp float blue;

    void main(void)


    lowp float a = texture2D(samplerFront, vTex).a;

    lowp float r = texture2D(samplerFront, vTex).r;

    lowp float g = texture2D(samplerFront, vTex).g;

    lowp float b = texture2D(samplerFront, vTex).b;

    gl_FragColor = vec4(r,g,b,1.0-a);


    <?xml version="1.0" encoding="UTF-8" ?>


    <!-- About -->

    <id>flipalpha</id> <!-- Never change the ID. Change the name instead -->

    <name>Flip Alpha</name>


    <description>Invert Alpha Channel</description>


    <!-- Settings -->

    <!-- Extend the bounding box for effect processing by a number of pixels to show the edges

    of effects which go beyond the object edges, e.g. blur and warp. -->



    <!-- Set to true if the background is sampled (samplerBack is referenced at all in the shader) -->


    <!-- Set to true if the background is not sampled at 1:1 with the foreground (e.g. the

    background texture co-ordinates are modified in some way by the shader, as done

    by Glass and Lens) -->


    <!-- Set to true if the effect changes over time, e.g. Noise or Warp effects. -->


    <!-- Parameters -->




    <description>Red level to set, from 0 to 100.</description>







    <description>Green level to set, from 0 to 100.</description>







    <description>Blue level to set, from 0 to 100.</description>







  • 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)