Blending 4 textures with splat map (WebGL)

I’m trying to blend 4 textures with splat map. It works with red, blue and black colors, but it doen’t with green.
Here’s my code:

vec4 t0 = texture2D(splatter, vUv).rgba;
vec4 t1 = texture2D( map, vUv ).rgba;
vec4 t2 = texture2D( map2, vUv).rgba;
vec4 t3 = texture2D( map3, vUv ).rgba;
vec4 t4 = texture2D( map4, vUv ).rgba;

t1 = mix(t1,  t2, t0.r);
t2 = mix(t2,  t3, t0.g);
t3 = mix(t1,  t3, t0.b);
gl_FragColor = mix(t4,  t3, t0.a);

t0 is splat map. What am I doing wrong?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.