How can I print variables output in godot shader?

Unfortunately you can’t.

Uniform variables are one way only. You can assign them via script but the shader can’t change them. Also, since the shader runs in your GPU you can’t print() or do any console related stuff.

There are several workarounds though. The first one is to print a meaningful color in the shader, for instance, if you’re trying to detect an area where your shader works, you can print full red vec4(1,0,0,1). But it all depends on what you’re trying to do.

I think, there are some tools, glslDevil, but I haven’t tried it.

Specifically, what are you trying to do?

1 Like