Hi,
I have finally started looking at shaders. I have made this little thing as a start based on something I found on the internet. This should take four textures, multiply them with alpha textures(red) and then add the results together. The sort of thing one might use for terrain texturing for instance.
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;
uniform sampler2D texture4;
uniform sampler2D texture5;
uniform sampler2D texture6;
uniform sampler2D texture7;
varying vec4 texCoord;
void main()
{
vec4 alpha1 = texture2D( texture0, texCoord.xy);
vec4 alpha2 = texture2D( texture1, texCoord.xy);
vec4 alpha3 = texture2D( texture2, texCoord.xy);
vec4 alpha4 = texture2D( texture3, texCoord.xy);
vec4 tex1 = texture2D( texture4, texCoord.xy * 100.0 );
vec4 tex2 = texture2D( texture5, texCoord.xy * 100.0 );
vec4 tex3 = texture2D( texture6, texCoord.xy * 100.0 );
vec4 tex4 = texture2D( texture7, texCoord.xy * 100.0 );
tex1 *= alpha1.r;
tex2 *= alpha2.r;
tex3 *= alpha3.r;
tex4 *= alpha4.r;
vec4 outcolor = tex1+tex2+tex3+tex4;
gl_FragColor = outcolor;
}
My question is what vertex shader (if any) should I use with this. Any other tips would be welcome.