Apply effect to only certain objects?

0 favourites
  • 12 posts
From the Asset Store
High quality sound effect pack, in the following categories: click, coin, damage, fail, jump, level up,message, shot
  • Hey there,

    I have a mostly transparent object that covers most of the screen. It has a shader effect (subtract) that changes the pixels below it, but I want it to effect only certain objects (i.e. a family of objects). Is there any way to do this?

    Thanks!

  • I haven't tried this before but~

    Perhaps the blend mode could works?

  • Not sure what you mean there. I'm open to any ideas.

  • So you want to have a subtract effect that only subtracts from certain objects?

    I think you can achieve this if you put the objects you want "effected", as well as the object with the subtract effect, on their own layer. Enable 'Force own texture' to the layer, and instead of drawing to the display, the layer will first draw to its own offscreen surface. That will mean the subtract effect is only applied to a transparent surface with the few objects you want processed on it underneath. Then the result is copied to the main display.

  • OK, Ashley, this is what I want exactly:

    Main layer. Everything on this layer should be effected.

    Background layer. Should not be effected at all.

    I tried what you said, but it doesn't seem to be working. Any tips?

    EDIT: 'source atop' makes it work perfectly! Cheers mate.

  • Hmm, I think some of the blend shaders don't handle alpha in the background properly actually, which prevents this from working.

    With a bug fix (for the next build), this is what you're after, right?

    http://www.scirra.com/labs/subtractlayer

  • That's exactly what I'm looking for. Interestingly enough, I got it working using 'source atop'... curious.

    Now, is there a way to do this so the subtractor is on a different layer? If that's not possible, is there a way to simulate parallax? The subtractor really needs to have parallax.

  • sqiddster, It sounds like I have a similar problem, where, for lighting, I have a black layer with the blend mode 'multiply' which basically darkens everything that's not lit up, however I want the background layer to be unaffected by this darken effect and to retain it's own brightness (due to it being in the far distance)

    You said 'source atop' works? What did you apply this to? I've tried a few things but nothing seems to be working.. thanks

  • I put the effect object on the main layer, set the layer properties to 'force own texture', and set the mask effect to 'source atop'.

  • I wish there was a layer mask property so one could easily specify a layer to mask another one without the need to worry about their order.

    Something along this lines, where one could specify the layer to use as a mask, the mask mode (if uses the layer's alpha or the RGB as transparency), and if the mask is inverted or no:

    <img src="https://dl.dropbox.com/u/7871870/Scirra%20graphics/C2%20interface/layer-mask-01.png" border="0" />

    Dealing with layer order for masking is somewhat confusing. With a layer mask property you could link an arbitrary number of layers to be masked by a single one, making management easier by eliminating the need to worry about the order or having to duplicate things.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That would be great! Ashley, make it happen. <img src="smileys/smiley36.gif" border="0" align="middle" />

  • It would be fantastic, it simplifies the matter, makes it familiar for people because of photoshop and it is quite easy.

    Maybe we could make another post as a suggestion using the same images or something similar?

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