I need to write a simple GLSL shader and I’m trying to avoid uniform inputs for the moment, only to see if the built in functions and vars are working and to get to know it a bit better.
My question is, how can I access the different object material layers in the fragment shader?
I can acess one layer as such:
sampler2D material; -> this value will be already set to the current object texture, right?
and it will be set to the texture the object has at that moment, so I can afterwards set it to:
gl_fragColor = texture2D(material, coord);
but how can I use multiple layers assuming the object already has 3 layers of texture? (Assuming I want a modulate effect)
something like this?
gl_fragColor = texture2D(material1, coord) * texture2D(material2, coord);
and using the same technique, is it possible to mix all this with the vertex color? if so, how can I access the vertex color? gl_Color? gl_FrontColor? I’m trying to acess it but it just wont return anything rather than black (0, 0, 0)