# Modifying alpha of pixels in sufrace/texture

I have a texture who's surface I've loaded with an image. Some areas of this image are completely transparent (alpha = 0), some completely opaque, and some are somewhere in the middle.

The issue I'm having is that when i draw the texture, the semi-transparent areas are "too" transparent. I want to make them more opaque.

In short, i want to multiply the alpha of all pixels on the surface by some constant. 0's will stay at zero. 255 will stay at 255. But the semi-transparent should get more opaque.

Is this possible? I've been messing around with the alpha blending render states but none of them seem to be able to do what i need them to do.

Thanks!

One easy way is to square-root the alpha.

Sqrt(0) -> 0; // stays transparent
Sqrt(1) -> 1; // stays opaque

// anything between becomes more opaque
Sqrt(0.125) -> 0.353553391;
Sqrt(0.25) -> 0.5;
Sqrt(0.5) -> 0.707106781;


You'll have to pre-process your texture or do it in the pixel shader.

pow(alpha, y) is another easy way to do it, pow(alpha, 0.5) is a square root, pow(alpha, 0.3333333333333333) is a cubic root, etc. Play with values of y above 0 and below 1.