Jump to content
  • Advertisement
Sign in to follow this  
Halsafar

Texture residing in a channel O_o

This topic is 4803 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!