Multiply??

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported
  • Why is the effect Multiply used to create light effecs? I mean, it works like it should, but I think the name is a bit missleading. What does the effect actually do? how does it work? <img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" />

  • Because it multiplies pixels together <img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" />

    I thought about calling it "Lighting" or something, but the standard name in all graphics applications is Multiply, so I thought I'd keep it consistent.

    The way pixel shaders work is every pixel is made up of values ranging from 0 to 1 for red, green and blue. So a dark red might be RGB 0.5, 0, 0, and 50% grey would be 0.5, 0.5, 0.5.

    If you use a multiply effect on a dark red background with a gradient from white (1, 1, 1) to black (0, 0, 0), you'll notice:

    (1, 1, 1) x (0.5, 0, 0) = (0.5, 0, 0)

    i.e. the white areas of a multiply effect have no effect on the background

    (0.5, 0.5, 0.5) x (0.5, 0, 0) = (0.25, 0, 0)

    i.e. the 50% grey areas of a multiply effect darken the background by 50%

    (0, 0, 0) x (0.5, 0, 0) = (0, 0, 0)

    i.e. the black areas of a multiply effect are always black (anything multiplied by 0 is 0).

    This means you can use a greyscale image with a multiply effect to darken regions of the background by different amounts, making a nice lighting effect.

  • Aah! thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, I have a few questions about effects too!

    Does erase do nothing else than changes the object it's applied black? Isn't it basically the same as applying a black colour filter?

    Back then, there was discussion about "cookie cutter" effect, or something like that. Is that effect implemented? The description of "Mask" looks like it, but it just reverses the alpha channel.

    Are the "combine" effects supposed to look this messy?

    http://student.sipoonlukio.com/~kontiopyry/misc/combine_additive.png

    What do they actually do?

    Does Glow have any other usage than using it after blur?

    What kind of blends are Overlay and Screen?

  • Erase and Mask are very similar if I recall correctly. They will erase the object's shape from the current display (like a cookie cutter). This is only useful with layers: each layer draws to its own texture, and then draws to the screen. Erase means the object's shape is erased from the texture drawn so far, so when the layer is added to the main display, there's a hole.

    However Construct will draw the layer directly to the screen if there are no effects on it (and opacity is 100% and colour filter is white). This means erase and mask won't work, because it can't cut holes from the main display! This is an unintentional side-effect of this display optimisation, so I'll add some kind of option to override it. For now setting a layer's opacity to 99% is a workaround.

    Eg. try:

    Layer 2: black background, 99% opacity, with a mouse-controlled sprite with Erase on it

    Layer 1: some tiled background so you can see what this layer looks like.

    The sprite will cut a hole in layer 2.

    The combine effects are special experimental effects. They combine the last stage in the effect chain with the first so must be used with other effects (otherwise you get undefined drawing like your picture) using blending (either additive or dodge). I think originally the theory was for a glow-round-the-edges effect - a thick outline followed by a blur, then add it together with the original image - but I just had a play with it and cant seem to do anything useful with them <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" />

    AFAIK Glow and HDR are only useful after blurs or softens.

    I forget what overlay is useful for, but Screen is a much nicer way of additive blending things like explosions.

  • Thanks, I got it now and I love the effect. Do you think that option to override the optimisation is manual or is Construct going to do it automatically, if there's erase or mask effect on the layer?

  • I'll probably make it a checkbox in layer properties. I don't like hard coding these things and there might be other areas that forcing a layer to its own texture might be useful.

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