translate the following shader to our format: /*originals "Voyager" by @kishimisu (2024) - https://www.shadertoy.com/view/M33XDH and https://www.shadertoy.com/view/XX3Szr*/ #define N_BOXES 10. #define ROTATION 1 #define DEPTH 5. mat2 rot(float a) { float s = sin(a); float c = cos(a); return mat2(c, -s, s, c); } float sdBox( in vec2 p, in vec2 b ) { vec2 d = abs(p)-b; return length(max(d,0.0)) + min(max(d.x,d.y),0.0); } float periphery(vec2 p, float s) { float per; float t = iTime * .1 + ((.25 + .05 * sin(iTime * .1))/(length(p.xy) + .117)) * 2.2; float si = sin(t); float co = cos(t); mat2 ma = mat2(co, si, -si, co); for (float i=1.; i<N_BOXES+1.; i++) { vec2 p0 = p; float a = radians(20./N_BOXES) *i; float mean = (N_BOXES+DEPTH*i)*.4; float box = sdBox(p0, vec2(s)*ma); float gamma = mean * 1e-4*.7; box = gamma/abs(box); per += box; } return per; } void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec3 tc, c; vec2 p = (fragCoord -.5* iResolution.xy) / iResolution.y; vec3 p2, q, f = vec3(.2, 2,.2); vec4 O = fragColor; vec2 F= fragCoord; vec2 R = iResolution.xy, u = abs(F+F-R)/R.y; float i, t, d, n, T = -iTime; for (O *= i; i++ < 50.; p2 = q = t * normalize(vec3(u * mat2(cos(T/16. + vec4(0,33,11,0))), 1)) ) n = tan(p2.z*0.5 - T*.05) * .5 + .5, p2.y += 1. + q.z * sin(T/6.) * .2 - n, t += d = length(p2= mod(p2, f+f) - f) - .1, O += .27 * pow(n, 5.) / ++d * (1. + cos( length(q*1.7) * .2 + length(u) * 3. - T / 1.4 )); float td; for (float i=0.; i<DEPTH; i+=.45) { float size = pow(0.25*O.y, i); float per = periphery(p, size); td += per; } c = vec3(DEPTH*0.2); tc += c*td*vec3(0.5,0.5,0.5); fragColor = vec4(tc, 1.); } Enhanced Depth
translate the following shader to our format: vec3 palette(float d){ return mix(vec3(0.2,0.7,0.9),vec3(1.,0.,1.),d); } vec2 rotate(vec2 p,float a){ float c = cos(a); float s = sin(a); return p*mat2(c,s,-s,c); } float map(vec3 p){ for( int i = 0; i<8; ++i){ float t = iTime*0.2; p.xz =rotate(p.xz,t); p.xy =rotate(p.xy,t*1.89); p.xz = abs(p.xz); p.xz-=.5; } return dot(sign(p),p)/5.; } vec4 rm (vec3 ro, vec3 rd){ float t = 0.; vec3 col = vec3(0.); float d; for(float i =0.; i<64.; i++){ vec3 p = ro + rd*t; d = map(p)*.5; if(d<0.02){ break; } if(d>100.){ break; } //col+=vec3(0.6,0.8,0.8)/(400.*(d)); col+=palette(length(p)*.1)/(400.*(d)); t+=d; } return vec4(col,1./(d*100.)); } void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec2 uv = (fragCoord-(iResolution.xy/2.))/iResolution.x; vec3 ro = vec3(0.,0.,-50.); ro.xz = rotate(ro.xz,iTime); vec3 cf = normalize(-ro); vec3 cs = normalize(cross(cf,vec3(0.,1.,0.))); vec3 cu = normalize(cross(cf,cs)); vec3 uuv = ro+cf*3. + uv.x*cs + uv.y*cu; vec3 rd = normalize(uuv-ro); vec4 col = rm(ro,rd); fragColor = col; } /** SHADERDATA { "title": "fractal pyramid", "description": "", "model": "car" } */ Texture Mapping