Search code examples
imagegraphicsvulkanstb-image

Loading cubemap images from png


I'm trying to create a skybox and just wanted to ask, is there any way to load a cubemap from single png image (https://i.sstatic.net/73tCt.png something like this) using something like stb_image for example and copy contents of it to vulkan image? what I mean is do I have to go into photoshop and split this single image into 6 different images and then copy each of them to cubemap image or can just load entire image and copy it somehow?


Solution

  • Yes, that's possible. Vulkan doesn't know about formats like PNG and you're free to copy from your source to a Vulkan image. In your case you'd create a Vulkan image cubemap and then use e.g. vkCmdCopyBufferToImage to copy the cube map faces from a raw (RGBA) stb buffer to the appropriate face of that image.