Skip to content
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

Fix strange alpha behaviour in cutout mode. #98

Merged
merged 1 commit into from
Jul 7, 2020
Merged

Fix strange alpha behaviour in cutout mode. #98

merged 1 commit into from
Jul 7, 2020

Conversation

emilianavt
Copy link
Contributor

Hi!

I am working on a face tracking application that captures the scene including the alpha channel. During this, I noticed some strange interactions with MToon's cutout mode:

  • The alpha channel was not anti-aliased and the camera's clear color leaked into anti-aliased edge pixels for MToon cutout materials.
  • Eyebrows using a MToon cutout material would create alpha holes in the face for semi-transparent pixels above the cutout threshold.

This very simple patch fixes both issues. Setting the alpha to 1.0 after clip should be fine. Pixels are already discarded if they are below the threshold. Otherwise, it should be safe to assume that they should be considered opaque. If blending should take place, the first line in the following ifdef block resets the alpha anyways.

@emilianavt emilianavt changed the title Fix strange alpha behaviour in Cutout mode. Fix strange alpha behaviour in utout mode. Jul 7, 2020
@emilianavt emilianavt changed the title Fix strange alpha behaviour in utout mode. Fix strange alpha behaviour in cutout mode. Jul 7, 2020
@Santarh Santarh merged commit 79569d5 into Santarh:master Jul 7, 2020
@Santarh
Copy link
Owner

Santarh commented Jul 7, 2020

Thank 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

Successfully merging this pull request may close these issues.

2 participants