Skip to content

respect face mask png transparency #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eyaler opened this issue Mar 15, 2021 · 0 comments
Open

respect face mask png transparency #4

eyaler opened this issue Mar 15, 2021 · 0 comments

Comments

@eyaler
Copy link

eyaler commented Mar 15, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant