Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Corruptinator | |
Old Version | Published before Godot 3 was released. |
I was wondering if anybody knew if there is a way to use an alpha mask on a 3D object?
I was experimenting around with the MaterialShader Language and I wanted to know if there is a way to apply an alpha mask to allow blending of two textures. I did see the “tex(texture,UV).rgba” but its not working the way I thought it should work. The Idea is to make an alpha mask so then it can be used to blend different materials say I wanted to blend a road texture with the cavern texture.
Here is the code that isn’t working:
FRAGMENT CODE:
uniform texture diffuse;
uniform texture diffuse2;
uniform texture blend;
color cavern = tex(diffuse,UV).rgba;
color road = tex(diffuse2,UV).rgba;
color alpha = tex(blend,UV).rgba;
DIFFUSE_ALPHA = vec4(cavern.r,cavern.g,cavern.b,alpha.a)+vec4(road.r,road.g,road.b,alpha.a);