Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Greyscale texture format in vulkan

Tags:

vulkan

OpenGL has greyscale texture format: GL_LUMINANCE. What is equivalent of internal format in Vulkan? Or how do we specify greyscale textures in vulkan?

like image 561
debonair Avatar asked Oct 29 '25 17:10

debonair


2 Answers

Take any single channel formats like VK_FORMAT_R8_UNORM for a 8 bit grayscale, VK_FORMAT_R16_SFLOAT for half precision floating point grayscale or VK_FORMAT_R32_SFLOAT for single precision floating point grayscale.

Pick the one that's supported that suits your needs.

like image 109
ratchet freak Avatar answered Oct 31 '25 10:10

ratchet freak


Ratchet Freak answers the question correctly. But if you're wondering why luminance has gone, there's some rationale from Khronos here in EXT_texture_rg for why Luminance and Luminance-Alpha formats have been replaced in favour of Red and Red-Green formats in modern graphics APIs.

Historically one- and two-component textures have been specified in OpenGL ES using the luminance or luminance-alpha (L/LA) formats. With the advent of programmable shaders and render-to-texture capabilities these legacy formats carry some historical artifacts which are no longer useful.

For example, when sampling from such textures, the luminance values are replicated across the color components. This is no longer necessary with programmable shaders.

It is also desirable to be able to render to one- and two-component format textures using capabilities such as framebuffer objects (FBO), but rendering to L/LA formats is under-specified (specifically how to map R/G/B/A values to L/A texture channels).

like image 25
Columbo Avatar answered Oct 31 '25 10:10

Columbo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!