Godot Version
4.2
Question
Hi there, sorry but I can’t understand why my code does not work, I’m just trying to mix textures on a planemesh, the idea is that if one texture is mixing it does not affect the mix, but it does…
shader_type spatial;
uniform sampler2D A;
uniform sampler2D B;
void fragment() {
vec4 _A = texture(A, UV);
vec4 _B = vec4(0.0);
if(textureSize(B,0).x !=0){
_B=texture(B, UV);
}
ALBEDO = mix(_A, _B, _B.a).rgb;
}
This shows white instead the A texture.
I know I can mix some textures using Next Pass, but it gets very tricky if I want to mix more than 2, but at least I’ll like to understand why this code is not working.
Any idea?
Thanks in advance