The algebra is simple:
Layer3 = Layer1*(1-O) + Layer2*O, where O - opacity of Layer2(in 0 -1 range)
So if you know the Layer2 value, then you can restore Layer2 opacity:
O = (Layer3 - Layer1)/(Layer2 - Layer1)
If you know the Layer2 opacity, then you can restore Layer2 color:
Layer2 = (Layer3 - Layer1*(1-O))/O
Otherwise you are stuck with indefiniteness. For example:
Layer1 - white
Layer2 - black at 50% opacity
Layer3 - 50% gray
at the same time:
Layer1 - white
Layer2 - 50% gray at 100% opacity
Layer3 - 50% gray
and there are lots more of other variants![Cheesygrin :cheesygrin: :cheesygrin:](/forum/img/smilies/psg-03/cheesygrin_y_22.png)
In your case you have four unknowns: O and Layer2 R,G,B. Just make simple equation system and solve it.
Layer3 = Layer1*(1-O) + Layer2*O, where O - opacity of Layer2(in 0 -1 range)
So if you know the Layer2 value, then you can restore Layer2 opacity:
O = (Layer3 - Layer1)/(Layer2 - Layer1)
If you know the Layer2 opacity, then you can restore Layer2 color:
Layer2 = (Layer3 - Layer1*(1-O))/O
Otherwise you are stuck with indefiniteness. For example:
Layer1 - white
Layer2 - black at 50% opacity
Layer3 - 50% gray
at the same time:
Layer1 - white
Layer2 - 50% gray at 100% opacity
Layer3 - 50% gray
and there are lots more of other variants
![Cheesygrin :cheesygrin: :cheesygrin:](/forum/img/smilies/psg-03/cheesygrin_y_22.png)
In your case you have four unknowns: O and Layer2 R,G,B. Just make simple equation system and solve it.
Last edited: