How can I send RGB texture into compute shader

Godot Version

4.2.2 stable
Vulkan API 1.3.277 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1660 Ti

Question

How can I send texture that doesn’t have alpha channel into compute shader?
I tried sending texture’s image data to the rd.texture_create() and in the texture format I’ve set R8G8B8_UNORM but then Godot throws an error that this format doesn’t support sampling. So I used R8G8B8A8_UNORM and it worked. But obviously it works only on images that have alpha channel. so .jpg files won’t work. Is there any function to convert RGB image or texture to RGBA, or something like that?

I’ve already created topic related to my problem but back then this problem wasn’t described properly. But here it is so you can get to know more background info about my project. Rendering device can't create the texture from file - #6 by bartusew

Did you try converting the image’s data to other formats?

1 Like

OMG thank you. That’s what I was looking for all this time. I was confident that there has to be something that allows converting RGB into RGBA or just addding the alpha channel. But I couldn’t found that. It’s so stupid that I didn’t thought about “convert” as name of a function.

Happy to help, I remember struggling with the same image format issues when learning compute shaders.

First time I linked an article I wrote as a solution :smile: I’ll take it as a sign to write more.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.