dl;dr: How do I pass constants to a material enabled in a custom render script?
Hello! I am trying to rebuild a microgame I put out in Godot with Defold, both for learning and because it’s a web game and I want to try to get that download size way down. I’m using Defold 1.9.6.
My current sticking point is shaders. Godot has a really easy way to apply a shader to an arbitrary part of the screen as opposed to an individual sprite.
I’ve used some open source code to compile Godot’s shader language into GLSL and made a fragment program out of that (with some modifications to get it working).
Then I made a new render with a material resource. That material uses the fp. It applies to the whole screen, but it looks correct.
However, I need to pass a time vec4 to the fp in order to get the effect I want. Eventually, I’ll also need to pass a vec4 to describe what part of the screen to apply the effect to, while drawing the rest of the screen normally.
So, how do I pass constants to a material being used in the render script?
Also, is this the correct approach? I had been trying to use render targets, but couldn’t get anything to work that way, and all the examples are out of date for the current version.
Thanks so much!