I have an image of concrete rocks of different shades of colors, and I'm applying this shader, but without referencing s_lightMap's uniform in my program:
precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D s_baseMap;
uniform sampler2D s_lightMap;
void main()
{
vec4 baseColor;
vec4 lightColor;
baseColor = texture2D( s_baseMap, v_texCoord );
lightColor = texture2D( s_lightMap, v_texCoord );
gl_FragColor = baseColor * (lightColor + 0.25);
}
it displays a picture with variable light color added to the final pixel color, but s_lightMap isn't even linked into the program, what is happening in this case, at first I thought it would just do the baseColor as the FragColor, but the addition of the 0.25 makes a non-negative result to (lightColor + 0.25). I'm confused, one minute I think lightColor would be set to a texture of 1's the next an array of 0's.
Or is it just random data? It doesn't appear at all random in the picture, it looks like it's obeying a rule of shading.
I'd like to mimic this effect in code that's not broken.
Here's the unshadded image:
Example "gimped" image of how it has variable shades (though this is an invert):