{
  "name": "Magic Snow Globe Hologram",
  "dimension": "3d",
  "slot": "action_bar",
  "width": 256,
  "height": 128,
  "textBaseline": 128,
  "placement": {
    "x": 0,
    "y": 0
  },
  "shapes": [],
  "texts": [],
  "heads": [],
  "images": [],
  "bars": [],
  "triggers": [],
  "world": {
    "glsl": "const int STATE_IDLE = 0;\n\nfloat goldStar2(vec2 p) {\n    const vec2 k1 = vec2(0.809016994, -0.587785252);\n    const vec2 k2 = vec2(-0.809016994, -0.587785252);\n    p.x = abs(p.x);\n    p -= 2.0 * max(dot(k1, p), 0.0) * k1;\n    p -= 2.0 * max(dot(k2, p), 0.0) * k2;\n    p.x = abs(p.x);\n    p.y -= 0.64;\n    vec2 ba = 0.45 * vec2(-k1.y, k1.x) - vec2(0.0, 1.0);\n    float h = clamp(dot(p, ba) / dot(ba, ba), 0.0, 0.64);\n    return length(p - ba * h) * sign(p.y * ba.x - p.x * ba.y);\n}\nfloat goldShape(vec3 p) {\n    const vec2 k1 = vec2(0.809016994, -0.587785252);\n    const vec2 k2 = vec2(-0.809016994, -0.587785252);\n    vec2 q = vec2(abs(p.x), p.y);\n    q -= 2.0 * max(dot(k1, q), 0.0) * k1;\n    q -= 2.0 * max(dot(k2, q), 0.0) * k2;\n    q.x = abs(q.x);\n    // Ten genuinely planar faces meet at a raised centre on either side.\n    float roof = (abs(p.z) + 0.17 * (q.y * 1.5625 + q.x * 3.75670) - 0.192) * 0.822;\n    q.y -= 0.64;\n    vec2 ba = 0.45 * vec2(-k1.y, k1.x) - vec2(0.0, 1.0);\n    float h = clamp(dot(q, ba) / dot(ba, ba), 0.0, 0.64);\n    float edge = length(q - ba * h) * sign(q.y * ba.x - q.x * ba.y);\n    return max(edge, roof) - 0.003;\n}\nvec3 goldNormal(vec3 p) {\n    vec2 e = vec2(0.0015, -0.0015);\n    return normalize(e.xyy * goldShape(p + e.xyy) + e.yyx * goldShape(p + e.yyx) + e.yxy * goldShape(p + e.yxy) + e.xxx * goldShape(p + e.xxx));\n}\nvec4 object(vec3 ro, vec3 rd, float t0, float t1, float time, vec3 light, inout float depth) {\n    float spin = time * 0.16 - 0.4 + rpw_seed * 0.17;\n    float bob = 0.045 * sin(time * 0.8 + rpw_seed);\n    vec3 o = ro - vec3(0.0, bob, 0.0);\n    vec3 d = rd;\n    o.xz = rpw_rot(spin) * o.xz;\n    d.xz = rpw_rot(spin) * d.xz;\n    o.xy = rpw_rot(0.05 * sin(time * 0.45)) * o.xy;\n    d.xy = rpw_rot(0.05 * sin(time * 0.45)) * d.xy;\n    vec3 color = vec3(0.0);\n    float alpha = 0.0;\n    float surfaceT = t1;\n    float t = t0;\n    bool hit = false;\n    for (int i = 0; i < 72; i++) {\n        vec3 p = o + d * t;\n        float h = goldShape(p);\n        if (h < 0.001) { hit = true; break; }\n        t += max(h * 0.88, 0.0008);\n        if (t > t1) break;\n    }\n    vec3 gold = vec3(1.0, 0.54, 0.07);\n    if (hit) {\n        surfaceT = t;\n        depth = clamp(t, t0, t1);\n        vec3 p = o + d * t;\n        vec3 n = goldNormal(p);\n        float facing = abs(dot(n, -d));\n        float fresnel = pow(1.0 - facing, 2.0);\n        vec3 l = normalize(vec3(-0.35, 0.7, 0.8));\n        float diffuse = max(dot(n, l), 0.0);\n        float specular = pow(max(dot(reflect(-l, n), -d), 0.0), 38.0);\n        float contour = exp(-abs(goldStar2(p.xy)) * 190.0);\n        float scan = pow(0.5 + 0.5 * cos((p.y - time * 0.034) * 195.0), 5.0);\n        float sweep = pow(0.5 + 0.5 * sin(p.y * 9.0 - time * 1.1), 18.0);\n        float polar = atan(p.x, p.y);\n        float seam = exp(-abs(sin(polar * 5.0)) * length(p.xy) * 140.0);\n        vec3 c = gold * (0.73 + 0.44 * diffuse + 0.25 * scan + 0.32 * sweep + 0.8 * fresnel);\n        c += vec3(1.0, 0.85, 0.38) * (1.25 * contour + 1.7 * specular + 0.53 * seam);\n        alpha = clamp(0.45 + 0.13 * scan + 0.2 * contour + 0.17 * fresnel + 0.08 * seam, 0.0, 0.94);\n        color = c * alpha;\n    }\n    float closest = clamp(-dot(o, d), t0, t1);\n    vec3 nearP = o + d * closest;\n    float haze = exp(-max(goldShape(nearP), 0.0) * 32.0) * 0.075;\n    color += (1.0 - alpha) * gold * haze;\n    alpha += (1.0 - alpha) * haze;\n    // Two slender, tilted holographic orbit traces.\n    for (int k = 0; k < 2; k++) {\n        float tilt = k == 0 ? 0.66 : -0.59;\n        float twist = k == 0 ? 0.3 : -0.35;\n        float radius = k == 0 ? 0.77 : 0.83;\n        vec3 oo = ro - vec3(0.0, bob, 0.0);\n        vec3 dd = rd;\n        oo.xy = rpw_rot(-twist) * oo.xy;\n        dd.xy = rpw_rot(-twist) * dd.xy;\n        oo.yz = rpw_rot(-tilt) * oo.yz;\n        dd.yz = rpw_rot(-tilt) * dd.yz;\n        if (abs(dd.y) > 0.001) {\n            float tt = -oo.y / dd.y;\n            if (tt >= t0 && tt <= t1) {\n                vec3 p = oo + dd * tt;\n                float dist = abs(length(p.xz) - radius);\n                float phase = atan(p.z, p.x) - time * 0.18;\n                float dots = pow(0.5 + 0.5 * cos(phase * 58.0), 8.0);\n                float strength = (exp(-dist * dist * 220000.0) * (0.048 + 0.14 * dots) + exp(-dist * 110.0) * 0.018) * smoothstep(0.01, 0.12, abs(dd.y));\n                float occ = tt > surfaceT ? 1.0 - alpha : 1.0;\n                color += gold * strength * occ * 1.3;\n                alpha += (1.0 - alpha) * strength;\n            }\n        }\n    }\n    // Sparkles follow the very same three-dimensional tilted circles.\n    vec3 right = normalize(cross(rd, abs(rd.y) < 0.95 ? vec3(0.0, 1.0, 0.0) : vec3(0.0, 0.0, 1.0)));\n    vec3 up = cross(right, rd);\n    for (int j = 0; j < 14; j++) {\n        float f = float(j);\n        bool first = mod(f, 2.0) < 1.0;\n        float a = floor(f * 0.5) * 0.8975979 + time * (first ? 0.24 : -0.19) + rpw_seed * 0.4 + (first ? 0.0 : 0.6);\n        float rad = first ? 0.77 : 0.83;\n        vec3 c = vec3(rad * cos(a), 0.0, rad * sin(a));\n        c.yz = rpw_rot(first ? 0.66 : -0.59) * c.yz;\n        c.xy = rpw_rot(first ? 0.3 : -0.35) * c.xy;\n        c.y += bob;\n        float tc = dot(c - ro, rd);\n        if (tc > t0 && tc < t1) {\n            vec3 q = ro + rd * tc - c;\n            float rr = length(q);\n            float twinkle = 0.35 + 0.65 * pow(0.5 + 0.5 * sin(time * 2.3 + f * 8.4), 4.0);\n            float radius = 0.009 + 0.007 * (0.5 + 0.5 * sin(f * 7.1));\n            float core = exp(-rr * rr / (radius * radius));\n            float glow = exp(-rr * 65.0) * 0.38;\n            vec2 s = vec2(dot(q, right), dot(q, up));\n            float crossGlow = exp(-abs(s.x) * 480.0 - abs(s.y) * 42.0) + exp(-abs(s.x) * 62.0 - abs(s.y) * 480.0);\n            float v = (core + glow + 0.55 * crossGlow) * twinkle;\n            float occ = tc > surfaceT ? (1.0 - alpha) : 1.0;\n            color += vec3(1.0, 0.75, 0.29) * v * occ * 1.8;\n            alpha = clamp(alpha + v * occ * 0.65, 0.0, 1.0);\n            if (v > 0.3 && tc < surfaceT) { depth = clamp(tc - radius, t0, t1); surfaceT = tc; }\n        }\n    }\n    if (!hit && alpha < 0.3) depth = closest;\n    return vec4(color / max(alpha, 0.0001), clamp(alpha, 0.0, 1.0));\n}",
    "prompt": "a floating hologram of a glowing gold Christmas star that slowly spins, with twinkling sparkles orbiting it",
    "size": 4
  }
}