[EFFECT] C2-DEX Fullscreen Version + VAlphaClip/help needed.

Share your Construct 2 effect files

Post » Fri Jul 08, 2016 9:14 am

C2-DEX Fullscreen Version by Funky Koval and Gigatron, original by Tulamide.

http://s000.tinyupload.com/?file_id=86337528332899979782 - UPDATED WITH VALPHACLIP EFFECT

C2-DEX Fullscreen Version is a palette remapper, based on C-DEX (https://www.scirra.com/forum/effect-c-dex_t69823) for Construct Classic by Tulamide. With generous help from Gigatron, I managed to get it it working order and am releasing it to the public. The effect is in the "Fullscreen" category. Here are some captures from the demo included:

Image

Here are some usage instructions:

-The most important thing to note is that the sprite containing the palette image must fit the game display area completely, otherwise incorrect colors will be sampled and artifacts will appear. That's why it's called the "Fullscreen Version".

-Palette sprite rotation is not supported, which should be a moot point, since it has to fit the screen.

-To remap the whole screen without any masking, all that's needed is the palette sprite stretched across the screen with the effect applied.

-Masking the effect uses the palette sprite's Alpha channel - the only limitation is that the pixel row from which the remap palette is taken has to be completely opaque. More about this in the parameter description section...
UPDATE Use VAlphaClip on the mask objects to clip them as they get close to the screen vertical edges. See updated demo .capx

-A more dynamic way of masking would be applying the effect to a layer and using the Destination Out blend mode on alpha sprites to cut the layer alpha (this method is shown in the .capx file). However, the limitation above applies - the palette row has to stay opaque.
UPDATE See above for workaround.

And now for the parameter descriptions:

Palette Y - the pixel row that will be used as the remap palette. 0 would be the top-most row and 1 the bottom. Inbetweens are handled accordingly. Remember that this particular row has to be completely opaque, otherwise invalid colors will be sampled.

Invert Mask Alpha - inverts the effect masking.

Intensity - blends the original colors with the remapped colors. If set to 0, effect has no... effect. If 1, only the remapped image is visible.

Have fun and enjoy the effect. And now to why it says "help needed" in the subject:

-For all shader writers: how would one write a shader that works like the "Destination Out" blend mode, but only on Alpha, preserving RGB? Using this shader on the masks would remove the limitation of having the palette pixel row fully opaque.

Any help is most apprectiated.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Sat Jul 09, 2016 4:37 am

The formula for alpha from src, dest is something like this :

Code: Select all
gl_FragColor = mix(vec4(dest.rgb, 1.0), vec4(src.rgb,1.0), (gl_FragCoord.x/iResolution.x-src.a)/(src.a/dest.a));


you know now ; dest is vec4 samplerback ... and src is vec4 samplerfront ... the sprite using fx on C2.

I have really no time to finish a huge list of my glsl fx list for C2. My goal is 500 Fx for C2;
Ok make some test with this formula ... will see later ;

Regards
B
62
S
21
G
29
Posts: 822
Reputation: 22,232

Post » Wed Jul 13, 2016 9:26 am

@Gigatron

Thanks. Yup, now I understand.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Sat Aug 06, 2016 1:35 pm

Thanks, Cool FX.
I made a nice example with it, check it out.
B
69
S
28
G
7
Posts: 85
Reputation: 7,521


Return to Effects

Who is online

Users browsing this forum: No registered users and 1 guest