you make edit the fragment shader to add the masks files and draw the body in last (after the clothes)
you must adapt my example to go with the current shader
eg
- Code: Select all
vec4 vmask0;
vec4 vmask1;
uniform sampler2D mask0;
uniform sampler2D mask1;
uniform bool b_mask0;
uniform bool b_mask1;
...
vec4 fragmentColor = vColor;
vec4 mask0v = vmask0;
if (b_mask0) mask0v = texture2D(mask0, vTextureCoord.st);
if (mask0v.r == 0.0 && mask0v.g == 0.0 && mask0v.b == 0.0) mask0v.a = 0.0;
vec4 mask1v = vmask1;
if (b_mask1) mask1v = texture2D(mask1, vTextureCoord.st);
if (mask1v.r == 0.0 && mask1v.g == 0.0 && mask1v.b == 0.0) mask1v.a = 0.0;
fragmentColor.a = transparentv.a * mask0v.a * mask1v.a;
gl_FragColor = vec4(fragmentColor.rgb * gl_FragColor.rgb, fragmentColor.a);
texture draw
- Code: Select all
enable(gl.BLEND);
blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
and
- Code: Select all
gl.enable(gl.DEPTH_TEST); // Enable depth testing
gl.depthFunc(gl.LEQUAL); // Near things obscure far things
gl.colorMask(true, true, true, true);
gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);