[EFFECT] Color Fusion (Masked)

This forum is currently in read-only mode.
From the Asset Store
Color Flow
$2 USD
60% off
Color all tiles with the same color in 22 moves or less!
  • This effect should be used as a layer effect only.

    Although it shares the same name with Color Fusion, it works a bit different.

    Basically it recolors whatever is beneath the layer it is applied to. But, other than the original Color Fusion, this version uses the layer it is applied to as a "cut mask". Whatever objects are placed on this layer are used to cut holes into the color field, letting the original colors shine through. Color Fusion (Masked) handles semi-transparencies (fog of war, spotlights, etc.) and even mixing the cut mask object's color.

    Example cap 1

    Example cap 2

    This effect might be the most simpliest way to do day-night-cycles with daytime independent light objects or fog of war with remembered spots and much more.

    How to use it

    There are 5 parameters:

    Red The red channel of the color as a color value (0-255)

    Green The green channel of the color as a color value (0-255)

    Blue The blue channel of the color as a color value (0-255)

    Intensity Defines how much of the new color is applied to the original colors, as a percentage value (0%-100%)

    Mix Mask Color A percentage value that defines how much of the mask object's color is mixed with the original colors (0%-100%)

    The color of a mask object is retrieved after other coloring methods. That means you may use an effect like Tint on that object or set the color filter, etc. This way you could get a yellow shining lamp or a red flashing signal. There are no limits. Resize the mask objects, rotate them, change their opacity, recolor them, Color Fusion (Masked) reflects all changes.

    How to install

    Download and place "Color Fusion (Masked).fx" in the effects folder.

    Download

    Color Fusion (Masked).fx

  • Yeah it does sound good for fog-o-war.

    Bet the canvas object would work well with that.

    Nice job thanks!

  • Nice one! But for fog of war an opaque layer (and maybe a PS 0.0 blend mode) with erase objects is probably less gpu hungry. This effect is awesome for lighting effects though, great job.

  • Really awesome! Though... The day/night example needs some adjustment - for starters, the transition between dawn and normal day is too slow, and I mean WAY too slow, it should be full light much earlier. Also, sunset happens way too early, as well. I know it's an example, but... Yeah, it's only full daylight for, like, a few in-game hours at most.

  • Great plugin, very useful.

    I have something i've been trying to do for my day/night circle but havent been able to figure out a solusion for yet. I would like the very lowest layer, the sky with the stars and moon, to shine through and not be darkened, but color/darken everything above. Otherwise the darkness would cover the stars, and the lamps would reveal them, wich looks wierd.

    Heres an example of what I'm going for: http://dl.dropbox.com/u/930918/light.jpg

    Is it possible to use or possibly tweak this plugin to achieve something like that? Perhaps a list where you specify what layers to affect.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is it possible to use or possibly tweak this plugin to achieve something like that? Perhaps a list where you specify what layers to affect.

    I'm not sure if there are easier ways to get to these results. However, pixel shader have only access to the current objects layer or the background (meaning everything rendered so far). The reason for this is, that a pixel shader is at the far end of the production line. When it comes to rendering the scene, a shader is called for every object such a shader is applied to. It will always render to a display size texture.

    Imagine you have three sprites "A", "B" and "C", in that order ("A" lowest, "C" highest) and the layout set to the color black. Every sprite is given an effect. When the scene is rendered, it starts with a display size texture set to the color black. Now sprite "A" is about to be rendered, so its effect is called. The result of the effect is rendered to its own texture in display size. Now the first texture and the second one are merged to the first one. Sprite "B" is now about to render, the same way as sprite "A". And it repeats for sprite "C". Finally the texture with all the other textures merged to is passed as output.

    If you would have had two layers, with "B" and "C" on layer 2 and instead of two effects for "B" and "C" you would have applied one effect to layer 2, then it would only do the black texture, sprite "A" texture and the layer 2 texture.

    A pixel shader gets a texture to work on, but isn't aware of the z-position of that texture or how many textures there might be.

    That said there might be a way with an altered version of 'Color Fusion (Masked)', but that would be a huge load for the gpu. I'm talking about 'keying'. It's something heavily used in films (look for the keywords "green screen", "blue screen", "chroma key", etc), but it is a post effect that uses a lot of processor power. It would be possible to enhance CF(M) in a way that it ignores a certain color and recolors and masks only those areas without that color. You would then setup your scene with a one-colored background instead of the starfield. Another layer above CF(M) would contain the starfield and an effect that replaces the key color areas with the starfield while showing the scene instead of the starfield where no key color is.

    A full HD game with two such effects might require a powerful graphics card...

    so, to the experienced constructors: Is there an easier way?

  • I'm not sure i fully understand your explanation of how pixel shaders work, so this might be an unnescessary question, but is it possible to create an effect that removes other effects? In that case i would darken the main layer in some way, for example using tint plus to controll the color of the overall lighting, and then have light-sprites with this counter-effect to remove what tint is doing.

  • I'm not sure i fully understand your explanation of how pixel shaders work, so this might be an unnescessary question, but is it possible to create an effect that removes other effects? In that case i would darken the main layer in some way, for example using tint plus to controll the color of the overall lighting, and then have light-sprites with this counter-effect to remove what tint is doing.

    This is not possible, I'm afraid. But with a combination of effects you might come close to what you have in mind. Have a look at this example, that's the closest I could get.

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