Sampling the Alpha Channel

Is it possible to sample the alpha channel? It doesn’t appear to work when I try it with a png.

I’m trying to come up with a way of having more than 6 textures on my terrain. I could use a seperate blendmap for each quad of my quad tree terrain.

6 textures will probably do tbh and I really don’t want to be sample from 3 blendmaps (for 9 textures) as I think that might really start to kill performance

In the Content Pipeline, turn off “Premultuply Alpha” for the image. It optimizes the channels if you’re sampling normally, but it changes the way alpha sampling works.

1 Like

Thanks. I’ll give that a try

@skyemaidstone Can you clarify what exactly does not work? Of course it is possible to sample the alpha channel and it works just like any other channel.

This is incorrect. Alpha values and how they are sampled stay exactly the same. The only thing this flag does, is it premultiplies the colors. I.e. for each pixel it multiplies the RGB values with the alpha value. It does not affect the alpha value itself. Premultiplied colors offer some advantages over the traditional representation, which is why this is a feature. As is often the case, Shawn Hargreaves has a great blog post about it: Shawn Hargreaves Blog Index

Hmm that does make more sense. Although I think I’ve run into the same issue before when trying to sample the alpha channel. I disabled premultiplication and the problem was solved so I didn’t think much of it, but I thought it seemed like the alpha values before and after were coming out differently. Unless I was using the wrong blend state without realizing it, which is also possible.

Helpful link! I always forget about all the good uses.

1 Like