Apply effect to only certain objects?

Get help using Construct 2

Post » Sun Sep 02, 2012 11:35 pm

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!sqiddster2012-09-03 02:34:00
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Sep 03, 2012 3:20 pm

I haven't tried this before but~
Perhaps the blend mode could works?
B
13
S
5
G
3
Posts: 63
Reputation: 3,989

Post » Mon Sep 03, 2012 3:57 pm

Not sure what you mean there. I'm open to any ideas.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Sep 03, 2012 4:01 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Sep 03, 2012 4:06 pm

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.sqiddster2012-09-03 16:12:00
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Sep 03, 2012 4:14 pm

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
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Sep 03, 2012 4:18 pm

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.sqiddster2012-09-03 16:21:46
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Sep 03, 2012 4:38 pm

@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
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Mon Sep 03, 2012 4:40 pm

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'.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Tue Sep 04, 2012 5:31 pm

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:



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.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Next

Return to How do I....?

Who is online

Users browsing this forum: h1k3, LeFuji and 21 guests