Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | quijipixel |
I’m new to shaders and can’t make them work properly in Godot 3.0. I have an Area2D
scene that has a Node2D
with a fragment shader. The shader works fine, but if I use another instance of the same scene and both are on screen, the shader only works for the closest scene to the player.
This is the shader’s code:
shader_type canvas_item;
uniform float frequency=30;
uniform float depth = 0.005;
void fragment() {
vec2 uv = UV;
uv.x = clamp(uv.x+sin(uv.y*frequency+TIME)*depth,0,1);
vec3 c = textureLod(TEXTURE,uv,0.0).rgb;
COLOR.rgb=c;
}
How does this shader thing works? It seems that the shader is somehow shared between instances instead of each having its own. The scene is to be a platform, so being able to have several instances on screen is important.