Texture residing in a channel O_o

Started by
8 comments, last by Facehat 18 years, 9 months ago
Maybe it is the wording which is throwing me off, but I hear this more and more especially when related to things like texture splatting, in fact this quote here came from the new texture splatting article: "I will use the term alphamap to refer to a grayscale image residing in a single channel of a texture. It can be any channel – alpha, red, green, blue, or even luminance." Now, I know textures have color channels in them, not color channels holding textures... I need some clarification of what this means... In VERY lamen terms.
Advertisement
A 8-bit grayscale texture can reside in a single channel of any texture.
"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
another way to say it: a one channel image can fit into one channel of a multiple channel (eg rgb) image.
[size="1"]
Okay I understand that somewhat.
RGB forms all standard pics sometimes RGBA or depending on endian ARGB.

So are you saying the I store the bits of greyscale texture in R and the bits of another greyscale texture in G, etc.
Is what you are saying?

A greyscale image is what you get when each channel (R,G,B) are the exact same value.

So if you have more than one that you need to send to the card at the same time (the order of which never changes) why not just pack up to 4 in the same texture being sent to the card.

R = greyscale image #1
G = greyscale image #2
B = greyscale image #3
A = greyscale image #4

And you just fit up to 4 greyscale textures into just one that needs to be sent to the card.
So is this done on the coding level, dx level, or is this combination of greyscale images into each channel done in a photo editing program like PaintShopPro.

sorry for the mighty bump...only a week or two.
My final question was not answered, my confusion still lies awake and I am about to begin texture splatting.
It could be either of the three, but usually you do it somewhere in your code (if you're doing texture splatting).

If you don't understand it though, I wouldn't worry about it too much; it's just an optimization. The reason for doing it is that you can only use so many textures during a given render pass (on modern cards, around 6-8), so it's helpful if you can sneak four extra textures in by encoding them into the channels of a single texture.
This method can really only work with grayscale though I would imagine?
A colored image needs RGB to be unique but its A channel could still be used to sneak one in.


I am having great difficulty trying to picture doing this in source code...

Is it done during the bmp loading?
When I actually get its bits, before I copy it to a texture surface...
Well, keep in mind that this trick is mostly usefull when you're doing stuff with pixel shaders. You are correct that you can only use grayscale images, but calling it "grayscale" is a bit of a misnomer. It's more a way of encoding information more than anything self. For instance, I might make a texture where the R value stores light intensity (like a lightmap), the G value stores shininess, and the B and A values store blend factors for two textures. In this way, each texel in the texture would act as a 4 byte datastructure for my pixel shader, essentially. Granted that's a bit of a contrived example, but the point is that a texture doesn't neccessarily have to be an image; it can be more abstract.

As to whether it's done during bitmap loading? Well, it could be, but it really depends on what you're doing.

This topic is closed to new replies.

Advertisement