How do I merge these two shaders to one?

Share your Construct 2 effect files

Post » Sun Feb 28, 2016 9:44 am

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:
Code: Select all
////
// Adjustment Layer
////

varying mediump vec2 vTex;
uniform lowp sampler2D samplerBack;

void main(void)
{
   gl_FragColor = texture2D(samplerBack, vTex);
}


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: Select all
////
// 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;
}


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!
B
6
Posts: 34
Reputation: 318

Post » Sun Feb 28, 2016 9:51 am

* moved to a more appropriate section.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
86
Posts: 5,415
Reputation: 59,516

Post » Sun Feb 28, 2016 10:21 am

Sorry zenox98,

I thought this section was more about presenting finalized effects. Thanks for moving!
B
6
Posts: 34
Reputation: 318


Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests