suggest, tip for have the full clothes (without skin)

This forum is aimed at user contributions, in the form of assets, side projects, code patches and similar.

Moderator: joepal

suggest, tip for have the full clothes (without skin)

Postby dark poulpo » Thu Jan 31, 2013 10:50 pm

hi, here a tip to draw the clothes with the hidden skin...

Capture.PNG
render



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); 




jeans_game_mask.png
mask2
jeans_game_mask.png (6.7 KiB) Viewed 958 times

tshirt_longsleeves_game_mask.png
mask1
dark poulpo
 
Posts: 37
Joined: Tue Oct 09, 2012 11:02 am

Return to User contributions

Who is online

Users browsing this forum: No registered users and 1 guest