Skip to content

respect face mask png transparency #4

Description

@eyaler

i added an option to use png face mask with transparency for the faceswap demo. this is useful when the mask contour exceeds the actual face and includes some of the background. in this case, allowing a transparent background in the mask allows a much cleaner effect. i changed in https://github.com/eyaler/tfjs_webgl_app/blob/master/face_landmark/render_facemesh.js#L32

void main(void)
{
    vec4 color;
    color = vec4(texture2D(u_sampler, v_texcoord));
    color[0] *= u_color[0];
    color[1] *= u_color[1];
    color[2] *= u_color[2];
    color[3] *= v_vtxalpha * u_alpha;
    gl_FragColor = color;
}

you can see it in work in my fork for offline videos: https://eyaler.github.io/tfjs_webgl_app/face_landmark
thanks for your awesome work! i learnt a lot from you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions