4

I'm trying to figure out a problem for a program I'm writing. I am calculating color values, and they get premultiplied by the alpha. I want to figure out what the alpha was before hand and divide the color by that.

I have the new premultiplied alpha (let's say alpha is $.25$ or $25\%$)

$\alpha = .25 * .25$;

$\alpha = .0625$

Given this information, I want to figure out $.25$ from $.0625$

$.0625 = x \times x$

My math is super bad/rusty. Any help would be great!

JimmyK4542
  • 54,331
M2tM
  • 171
  • 7

1 Answers1

3

As per Cure's suggestion:

sqrt(.0625) does what I want!

*EDIT: For those curious, you can see the related issue I had: https://stackoverflow.com/questions/24346585/opengl-render-to-texture-with-partial-transparancy-translucency-and-then-rende

This solved my problem 100%.

M2tM
  • 171
  • 7