41
Support / Re: Texture Splatting with 4 textures but using 5 sampler2D uniform variables
« Last post by EgonOlsen on July 19, 2023, 10:50:41 am »Is this using jPCT or jPCT-AE?
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.