{
  "name": "Floating Koi Sphere",
  "dimension": "3d",
  "slot": "action_bar",
  "width": 256,
  "height": 128,
  "textBaseline": 128,
  "placement": {
    "x": 0,
    "y": 0
  },
  "shapes": [],
  "texts": [],
  "heads": [],
  "images": [],
  "bars": [],
  "triggers": [],
  "world": {
    "glsl": "float koiEll(vec3 p, vec3 r) {\n    float k0=length(p/r); float k1=length(p/(r*r));\n    return k0*(k0-1.0)/max(k1,0.0001);\n}\nvec3 koiLocal(vec3 p,float tm,float id) {\n    float a=tm*0.24+id*3.14159265+0.70;\n    vec3 radial=vec3(cos(a),0.0,sin(a));\n    vec3 forward=vec3(-sin(a),0.0,cos(a));\n    vec3 q=p-radial*0.38-vec3(0.0,0.14*sin(a+0.6),0.0);\n    q=vec3(dot(q,radial),q.y,dot(q,forward))/1.24;\n    q.x-=0.020*sin(tm*2.2+q.z*12.0+id)*smoothstep(0.15,-0.30,q.z);\n    return q;\n}\nvec2 koiShape(vec3 q) {\n    float d=koiEll(q,vec3(0.090,0.105,0.235)); float mat=0.0;\n    float head=koiEll(q-vec3(0.0,-0.004,0.168),vec3(0.075,0.081,0.101));\n    d=min(d,head);\n    float tail=max(max(abs(q.y+0.005)-0.014,abs(q.z+0.293)-0.094),abs(q.x)-(0.024+clamp((-q.z-0.20)*0.66,0.0,0.13)));\n    if(tail<d){d=tail;mat=1.0;}\n    vec3 f=vec3(abs(q.x)-0.101,q.y+0.038,q.z-0.013);\n    f.xz=rpw_rot(-0.48)*f.xz;\n    float fin=koiEll(f,vec3(0.079,0.011,0.058));\n    float dorsal=koiEll(q-vec3(0.0,0.097,-0.055),vec3(0.010,0.052,0.105));\n    fin=min(fin,dorsal);\n    if(fin<d){d=fin;mat=1.0;}\n    vec3 e=vec3(abs(q.x)-0.061,q.y-0.024,q.z-0.208);\n    float eye=length(e)-0.017;\n    if(eye<d){d=eye;mat=2.0;}\n    return vec2(d,mat);\n}\nfloat koiMap(vec3 p,float tm) {\n    return 1.24*min(koiShape(koiLocal(p,tm,0.0)).x,koiShape(koiLocal(p,tm,1.0)).x);\n}\nfloat waterCaustic(vec3 p,float tm) {\n    vec3 v=p*17.0;\n    float c=sin(v.x+sin(v.z*0.81+tm*0.45))+sin(v.z+sin(v.y+tm*0.37))+sin(v.y+sin(v.x*0.71-tm*0.32));\n    return pow(max(0.0,1.0-abs(c)*2.8),5.0);\n}\nvec4 object(vec3 ro,vec3 rd,float t0,float t1,float time,vec3 light,inout float depth) {\n    float b=dot(ro,rd); float h=b*b-dot(ro,ro)+0.87*0.87;\n    if(h<0.0)return vec4(0.0);\n    h=sqrt(h); float tn=max(t0,-b-h); float tf=min(t1,-b+h);\n    if(tf<tn)return vec4(0.0);\n    vec3 p=ro+rd*tn; vec3 n=normalize(p);\n    float edge=1.0-abs(dot(n,rd)); float fres=0.025+0.975*pow(edge,5.0);\n    vec3 refl=rpw_sky(reflect(rd,n));\n    vec3 sun=normalize(vec3(0.4,0.8,0.3));\n    float spec=pow(max(0.0,dot(reflect(rd,n),sun)),190.0);\n    float ca=waterCaustic(p,time);\n    float shellA=clamp(0.055+fres*0.76+ca*0.07+spec*0.5,0.0,0.94);\n    vec3 shellC=mix(vec3(0.13,0.52,0.65),refl,0.73)+vec3(0.6,0.9,1.0)*ca*0.28+vec3(1.0,0.96,0.85)*spec*1.8;\n    vec3 col=shellC*shellA; float alpha=shellA;\n    float t=tn; bool hit=false;\n    for(int i=0;i<80;i++){\n        float d=koiMap(ro+rd*t,time);\n        if(d<0.0012){hit=true;break;}\n        t+=max(d*0.85,0.001);\n        if(t>tf)break;\n    }\n    if(hit){\n        vec3 fp=ro+rd*t;\n        vec3 q0=koiLocal(fp,time,0.0); vec3 q1=koiLocal(fp,time,1.0);\n        vec2 s0=koiShape(q0); vec2 s1=koiShape(q1);\n        vec3 q=s0.x<s1.x?q0:q1; float mat=s0.x<s1.x?s0.y:s1.y;\n        float ep=0.0015;\n        vec3 normal=normalize(vec3(koiMap(fp+vec3(ep,0.0,0.0),time)-koiMap(fp-vec3(ep,0.0,0.0),time),koiMap(fp+vec3(0.0,ep,0.0),time)-koiMap(fp-vec3(0.0,ep,0.0),time),koiMap(fp+vec3(0.0,0.0,ep),time)-koiMap(fp-vec3(0.0,0.0,ep),time)));\n        float pattern=rpw_noise(q*vec3(28.0,21.0,17.0)+vec3(s0.x<s1.x?2.0:8.0,1.0,0.0));\n        float orange=smoothstep(0.47,0.53,pattern);\n        vec3 base=mix(vec3(0.94,0.95,0.89),vec3(1.0,0.235,0.016),orange);\n        if(mat>0.5)base=mix(vec3(0.91,0.79,0.57),vec3(1.0,0.36,0.055),0.5+0.3*sin(q.z*180.0+abs(q.x)*150.0));\n        if(mat>1.5)base=vec3(0.015,0.022,0.027);\n        float dif=max(dot(normal,sun),0.0);\n        vec3 fc=base*(0.44+0.60*dif)*max(light,vec3(0.25));\n        fc+=vec3(0.45,0.78,0.83)*waterCaustic(fp,time)*(0.10+0.20*max(normal.y,0.0));\n        fc+=pow(max(dot(reflect(rd,normal),sun),0.0),75.0)*0.42;\n        fc=mix(fc,vec3(0.12,0.49,0.55),0.07*(t-tn));\n        col+=(1.0-alpha)*fc; alpha=1.0;\n    }else{\n        vec3 back=ro+rd*tf; vec3 bn=normalize(back);\n        float bc=waterCaustic(back,time);\n        float ba=0.035+0.12*pow(edge,3.0)+0.06*bc;\n        vec3 bcol=vec3(0.16,0.57,0.69)+bc*vec3(0.45,0.65,0.66);\n        col+=(1.0-alpha)*bcol*ba; alpha+=(1.0-alpha)*ba;\n    }\n    depth=tn;\n    return vec4(col/max(alpha,0.0001),alpha);\n}",
    "prompt": "a floating sphere of clear water with two orange and white koi fish swimming in a slow circle inside, caustic light rippling",
    "size": 5,
    "summary": "Two orange-and-white koi swim in a slow circle inside a clear floating water sphere, with swaying fins, sky reflections, and gently rippling caustic light."
  }
}