How do you overwrite a texture using shaders?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Xian

Hi, I wanted to make a functional 2D sky using colorRect and shaders. I have 3 textures that I passed to the shader via uniform, but I can’t seem to figure out how to overlay the newer textures above the previous one Via COLOR property. Please help me.

:bust_in_silhouette: Reply From: Xian

Never mind, I manage to solve it. I just did

vec4 overlay(vec4 destination, vec4 addable){
	return (addable.a > 0.0)? addable : destination;
}

And that fixed it.