Santarh / MToon

Toon Shader with Unity Global Illumination
MIT License
538 stars 60 forks source link

Fix strange alpha behaviour in cutout mode. #98

Closed emilianavt closed 4 years ago

emilianavt commented 4 years ago

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:

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.

Santarh commented 4 years ago

Thank you.