Last active
February 13, 2022 05:30
-
-
Save ruby0x1/d929ccabf4c81e289fde03b5e7e360c6 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