Created
August 29, 2017 00:24
-
-
Save andybak/308bcb11118691fecda084c5b1aba814 to your computer and use it in GitHub Desktop.
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 fBoxCheap(float3 p, float3 b) { //cheap box | |
return vmax(abs(p) - b); | |
} | |
inline float fBox(float3 p, float3 b) { | |
float3 d = abs(p) - b; | |
return length(max(d, float3(0,0,0))) + vmax(min(d, float3(0,0,0))); | |
} | |
inline float DistanceFunction(float3 pos) | |
{ | |
float t = _Time.x; | |
pModMirror2(pos.xy, float2(t,t)); | |
float box = fBox(pos, float3(1,1,1)); | |
float sphere = length(pos - float3(1,1,1)) - 1; | |
float d = min(box,sphere); | |
float guard = -fBoxCheap(pos, float3(0.25,0.25,0.25)); | |
guard = abs(guard) + 0.05; | |
return d; | |
return min(d,guard); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment