2
$\begingroup$

While programming something in Rust with the BevyEngine, I came across TextureFormats. My understanding is that those are used to define how the pixel data is handled. So Rgba8Unorm means that there are is a red, green, blue and alpha channel. Each of them is represented by an 8bit unsigned integer.

Since I only need a black/white image I read through this list of available TextureFormats in the BevyEngine. But all the "one channel formats" have only one channel for red. Also here in the wgpu-rs crate. There are so many formats with only one channel for red.

Why is that. What is the purpose of having only the red channel. And why am I not abled to find a format that allows me to represent only B/W values. (Is that maybe an "alpha only" format?)

$\endgroup$

1 Answer 1

4
$\begingroup$

Red is the gray scale channel (black/white). To generate a gray scale image copy the Red channel to the Green and Blue channels, set alpha to one and a gray scale image will result.

Of course that single channel can be used for many other purposes besides just gray scale image data. It can represent noise, a lookup table (LUT). The list is long and mighty.

$\endgroup$
2
  • $\begingroup$ So its the red channel just because it is the first in the classic rgb scheme? $\endgroup$
    – Voß
    Jul 30, 2021 at 12:10
  • $\begingroup$ Yes, sometimes it is better to think of them as data channels and the r,g,b,a values are just the names. $\endgroup$
    – pmw1234
    Jul 30, 2021 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.