1
Support / Re: Texture Splatting with 4 textures but using 5 sampler2D uniform variables
« on: July 20, 2023, 12:20:12 am »
Thank you, guys! I think that's it. I'll rewrite the shader and use only jpct-ae from now on.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
varying vec2 texCoord;
uniform sampler2D textureUnit0;
uniform sampler2D textureUnit1;
uniform sampler2D textureUnit2;
uniform sampler2D textureUnit3;
uniform sampler2D textureUnit4;
const vec3 BLACK = vec3(0.0,0.0,0.0);
const vec3 YELLOW = vec3(0.5,0.5,0.0);
void main (){
vec2 newTexCoords = texCoord * 20.0;
vec4 map = texture2D(textureUnit0, texCoord);
vec4 asphalt = texture2D(textureUnit1, newTexCoords);
vec4 grass = texture2D(textureUnit2, newTexCoords);
vec4 ground = texture2D(textureUnit3, newTexCoords);
vec4 wall = texture2D(textureUnit4, newTexCoords);
vec3 a = mix(BLACK, asphalt.rgb, map.r);
vec3 b = mix(BLACK, grass.rgb, map.g);
vec3 c = mix(BLACK, ground.rgb, map.b);
vec3 d = mix(BLACK, wall.rgb, map.a);
vec3 result = a+b+c+d;
gl_FragColor = vec4(result,1.0);
}
This is the result:vec3 result = a+b+c+d;
tovec3 result = a+b+c+mix(BLACK, YELLOW, map.a);
Config.maxTextureLayers = 10;
but no success, unfortunately.