Last active
August 14, 2018 07:36
-
-
Save sugi-cho/b2322638c86f251a8279dfa6345f2c1f to your computer and use it in GitHub Desktop.
Quad-Wireframe using UV
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
half wire(half2 uv) { | |
half2 d = fwidth(uv); | |
half2 a2 = smoothstep(half2(0, 0), d*1.0, uv); | |
half w = 1.0 - min(a2.x, a2.y); | |
return w; | |
} | |
fixed4 frag(v2f i) : SV_Target | |
{ | |
float2 uv = frac(i.uv * 20); | |
half w = max(wire(uv), wire(1 - uv)); | |
return w; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment