Blend mode issues

0 favourites
  • 5 posts
  • Hello all!

    I have a texture (tiled background) that will cover the whole layout (so I only need one of them). I want to be able to specify where it is seen using masking. However, I run into a situation where the masking object's transparent background has a different effect than having none of the object.

    Here's what I mean. There's a single circular mask in the middle, so I want to be able to mask out ALL the orange except the circle. However, you can see the masking effect not work outside the boundaries of the masking image. I guess this makes sense, but what can i do here?

    I'm aware I could just use a different blend mode and mask where the texture is not, however there are two issues with this.

    1. Since the masked shapes are pretty simple, masking where the texture is 'not' is much more complex and will use many more sprites.

    2. I'm also using the mask as a collision detector. This could save a lot of time and objects.

    Let me know if you have any ideas?

  • I think this is just one of the few cases you need a large area of transparency around the mask image.

    You could also try playing with some other blend modes, like 'destination out' to cut a hole in a layer, and 'force own texture' on the layer to ensure it is drawn separately then copied to the main display. With some creative tricks you can sometimes make the same visual thing a different way.

  • Set Mask to blend mode normal

    Put Texture on top in the same layer

    Set Texture to source-in

    Only the orange inside the circle will appear.

    The only issue with that technic is that you will see the black circle when it's out of the orange texture.

    The solution I came up with was to create a shader that set pure black pixels to transparent and apply it to the layer. If there's pure black in your the texture you want to in place of the orange, you should just set them to 1% instead of 0% grayscale.

    capx

    Black To Alpha fx

  • Yann

    Brilliant, mate! Never thought of applying the effect to the texture.

    Thanks for going the extra mile with that black to alpha effect, however it's not necessary as the texture always will cover the whole screen.

    Thanks again!

    EDIT: Just applied it to the game, works like a charm ;)

    Now I only need one type of object, and 10 times as less :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yann nice one, clever solution!

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