Hmm⌠I mean, transparency is not controlled by the color channels. Right now youâre just fading the red channel based on the UV-position.
Transparency is achieved by first setting the Transparency property to Alpha, and then utilizing the alpha-channel to modulate how opaque the pixels are.
If I understand your question correctly, you should be using the vertex position instead of UV coordinates since UVs are used for texturing and will not always âpointâ to the top of the mesh.
Perhaps you should look at some beginner guides for writing shaders:
Depends on how you set it up in the shader, here is an example, which has some parameters and they are bound to the meshes true top and bottom, so you will always get a gradient result from bottom to top, and with the parameters you can control the gradient somewhat.
I am still figuring out how to do some of these things in godotâs shaders, so what you see here could be done in different or better ways, for instance not even needing the model_height instanced parameter if there is some way to get the model bounds to extract the height, just not sure how to do that yet.
The Visual Shader setup in godot is a good place to learn if you still want to learn shader coding, or you can just do them all in that setup.
But with the Visual Shader editor you can more easily try things out, even if itâs just simple things like âmake a gradient from the bottom to top of this assetâ, as the nodes have some helpful titles, and then once you get something that you like, you can check out the code it generates (look to the right of the Visual Shader editor window, itâs a piece of paper that has colorful lines on it).