#ifdef GL_ES precision mediump float; #endif #define MAX_STEPS 50 #define MAX_DIST 50. #define SURF_DIST .001 #define TAU 6.283185 #define PI 3.141592 #define S smoothstep #define T u_time uniform vec2 u_resolution; uniform float u_time; mat2 Rot(float a) { float s=sin(a), c=cos(a); return mat2(c, -s, s, c); } float sdBox(vec3 p, vec3 s) { p = abs(p)-s; return length(max(p, 0.))+min(max(p.x, max(p.y, p.z)), 0.); } vec3 translate(vec3 p) { p.xy *= Rot(u_time*0.4); p.yz *= Rot(u_time*0.4); return p; } float GetDist(vec3 p) { float d = sdBox(p, vec3(1)); /* d += sin(p.x*5.+u_time)*0.5; d += sin(p.y*2.+u_time)*0.5; d += sin(p.z*5.+u_time)*0.5; */ return d; } float RayMarch(vec3 ro, vec3 rd) { float dO=0.; for(int i=0; iMAX_DIST || abs(dS)