-
-
Save iomeone/238eab1444253680e7def0d8030ae22f to your computer and use it in GitHub Desktop.
simple MSDF shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float r = sample.r; | |
float g = sample.g; | |
float b = sample.b; | |
float median = max(min(r, g), min(max(r, g), b)); | |
float signed_dist = median - 0.5; | |
float d = fwidth(signed_dist); | |
float opacity = smoothstep(-d, d, signed_dist); | |
//apply opacity to final alpha | |
color.a *= opacity; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment