Why do two 50% opacity layers of the same color don't make the solid color in Photoshop?

I am trying to create a gradient that when flipped and overlayed on itself will show a solid color.

I thought I would make it with a regular solid-to-transparent gradient on Photoshop, and save it as PNG, but when superimposed on one another, it still shows some transparency.

I tried to do it inside Photoshop and the same experiment with regular layers that had 50% opacity does not show the solid color (i.e. it does not "kill" the transparency).

What am I missing?

-
Can you post an image to show what you're trying to do? – Andrew Vit Dec 1 '11 at 7:48

2 Answers

The opacity is a multiplier. Assume:

• Layer 1 opacity = 50%
• Layer 2 opacity = 50%
• Layer 3 opacity = 50%

Net opacity = Layer1 + (Layer2 * Layer1) + (Layer3 * Layer2 * Layer1)

Or, 50% + 25% + 12.5%. You would mathematically never get to 100%.

-
The related function is `f(x) = 2^-x`. As `x` approaches infinity, `y` approaches `0`. So, in our case, the transparency would never cancel out (be zero). – iglvzx Dec 1 '11 at 8:35

The way I look at it, each layer lets 50% of the light through... you don't get 100% with it.

It's like the weatherman saying there's a 50% chance of rain on Saturday and on Sunday, and concluding that it must rain sometime during the weekend. Obviously it doesn't mean that. :-)

-
That sounds right. The first layer lets through 50% of the light. The second layer lets through 50% of remaining light. Result: 25% of the light gets through. (I'm not a Photoshop user, but if its layers emulate real-world physics, that's how I'd expect them to behave.) – Keith Thompson Dec 1 '11 at 5:10
Hey thanks, I think that's it. "50% of 50% is not 0". So, any ideas how I might be able to create that gradient that flipped makes the solid color? – Ozkar Dec 1 '11 at 5:19
@Ozkar: I think I figured it out: Check out the Subtract "Mode" above the Layers tab. Make the upper layer subtract from the lower layer (which is normal), and you should be able to get something working after playing around with it. – Mehrdad Dec 1 '11 at 5:24
Mmmh... I'm on CS3, I can't find 'Subtract', I tried 'Difference' and 'Exclusion' and none seem to get me near there. :S (I want a pixel-perfect solution, because if I try to make it aprox, by looking at it I will mess it up hehe. – Ozkar Dec 1 '11 at 5:41
Your weather example is misguided. If the two days were independent, the probability of rain for the weekend would be `25%`. – iglvzx Dec 1 '11 at 8:13