Alpha channels are darker than RGB channels?

For an element of my project I’m packing four greyscale images into the layers of a texture–one each in the red, green, blue, and alpha channels.

This works well–save for the fact that, for some reason, the images stored in the alpha channels, as rendered by a shader, are noticeably darker than those in the other three channels.

In my image-editor (GIMP), all four channels appear to be of the same overall brightness.

Is this an expected result? And if so, is there anything that I might do in order to produce even lightness across all channels? (Aside, I suppose, from brightening the alpha channel.)

Hmm, maybe just a matter of sRGB mode. In fact, the alpha channel is a technical layer, and it is quite possible that it is not corrected in color.

Hmm… maybe, indeed.

Is there a way to have it be corrected…?

The question is interesting, I think maybe you need to change the texture type to something like sRGBA. Just a guess.Texture — Panda3D Manual

Ah, it does look like that improves matters–thank you! :slight_smile:

I decided to add information to the answer with a flag so that others could understand what I meant. I hope that’s what you used?

@serega-kkz is correct, alpha channels are always stored linear and don’t use the sRGB transfer function, so the gamma is different.

There is no way to use the sRGB gamma curve with the alpha channel. The F_rgba mode in Panda uses linear sampling for all channels, whereas F_srgb_alpha uses gamma correction for the RGB channels and linear sampling for the alpha channel.

1 Like

Yup, that’s exactly the one. :slight_smile:

Ah, fair enough, and thank you for the explanation!

Ah, I see–in that case “F_rgba” might be better still for my purposes.

I am going to want to think about whether and how I’m going to apply this fix, as it may have consequences for other colours in my project if applied universally.

But it does look as though the problem is as you two outlined, and that a solution is available. :slight_smile:

1 Like