The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Hello, I am making a bullethell game in Godot, and I need to be able to read data from the GPU such as a bool for if the player is hit. I see that you can not set uniforms in the shader, so I need another way to do this. (or if there is a way please correct me) If anyone has an idea that would be much appreciated.

in Engine by (60 points)

1 Answer

0 votes

The output of a shader is an image, you could process what comes out.
Another option in Godot 4.0+ is using compute shaders that are not specialized for manipulating images, rather doing any generic paralell computation. Haven't looked into it but I assume they take a PackedByteArray and write into it.
The point of a uniform is that is has the same value in every execution of the shader so yeah, you can't write to it.

by (1,957 points)

I think that sounds like a great idea. The only other problem that arises is that I need the position of the particles to be able to check if they are close to the player. Is there anyway to get the transform of the particles outside of a particles shader?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.