How do I merge these two shaders to one?

  • Hello,

    after wondering why my effect was not rendered properly on my object, I realized (after reading some threads on this forum) that the Waterbackground effect had to be applied first (as some sort of adjustment layer, like in After Effects).

    To minimize the computational impact of the Waterbackground effect, I reduced it to this following effect, which I simply called Adjustment Layer:

    ////
    // Adjustment Layer
    ////
    
    varying mediump vec2 vTex;
    uniform lowp sampler2D samplerBack;
    
    void main(void)
    {
    	gl_FragColor = texture2D(samplerBack, vTex);
    }
    [/code:1r5uh3wj]
    
    If I put this Adjustment Layer Effect before my own Mirror Effect, everything is rendered properly. Here is the code for the Mirror Effect (please ignore strange output, still Work In Progress):
    [code:1r5uh3wj]
    ////
    // Mirror
    ////
    
    varying mediump vec2 vTex;
    uniform lowp sampler2D samplerBack;
    
    void main()
    {
    	lowp vec4 front = texture2D(samplerBack, vec2(vTex.x, abs(1.0 - vTex.y)));
    	front.rgb = mix(front.rgb, vec3(128.0, 180.0, 255.0) / 255.0, 0.15 + (0.25 - vTex.y) * 2.0);
    	gl_FragColor = front;
    }
    [/code:1r5uh3wj]
    
    Now I would like to merge these two effects into one, so that I do not have to put the Adjustment Layer before this Mirror Effect. As I have VERY LITTLE knowledge in HLSL, I would like to ask you for help (and guidance if it is even possible to merge these two). Thank you!
  • * moved to a more appropriate section.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry zenox98,

    I thought this section was more about presenting finalized effects. Thanks for moving!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)