Last active
September 24, 2018 23:59
-
-
Save gamemachine/d97869b20046c2f3b515679f4c7b266f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| void ClipBounds(float4 bounds, float2 pos) { | |
| float2 min = bounds.xy; | |
| float2 max = bounds.zw; | |
| float a = step(min.x, pos.x); | |
| float b = step(pos.x, max.x); | |
| float c = step(min.y, pos.y); | |
| float d = step(pos.y, max.y); | |
| clip(3.0f - a - b - c - d); | |
| } | |
| // Call from surface shader like so | |
| ClipBounds(_Mask1, IN.worldPos.xz); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment