fogón

← Fantasy3D assetfogon/hongos-brillantes

Hongos brillantes

by fogonCC010858 blocks
Hongos brillantesDrag to turn it
// «Hongos brillantes» · gpt-6-sol (medium)
// A cluster of glowing magic mushrooms of different heights: slender pale stems and round caps glowing teal and violet with lighter dots, growing from a mossy rock.

// Mossy stone foundation
const stone = ["#414950", "#505a60", "#606b70", "#738079"];
for (let x = 7; x <= 41; x++) {
  for (let y = 10; y <= 39; y++) {
    for (let z = 0; z <= 9; z++) {
      const d = ((x - 24) / 17.5) ** 2 +
                ((y - 24) / 15) ** 2 +
                ((z - 2) / 7.5) ** 2;
      if (d < 1 && z <= 7 + 1.2 * Math.sin(x * 0.7 + y * 0.4)) {
        const shade = z > 5 ? 2 : z < 2 ? 0 : 1;
        set(x, y, z, stone[Math.min(3, Math.max(0, shade + (rand() < 0.14 ? 1 : 0)))]);
      }
    }
  }
}
ellipsoid(13, 29, 3, 6, 7, 4, "#515d61");
ellipsoid(35, 18, 3, 6, 6, 4, "#485358");

// Moss follows the upper surface of the rock.
for (let x = 8; x <= 40; x++) {
  for (let y = 11; y <= 38; y++) {
    for (let z = 9; z >= 3; z--) {
      if (get(x, y, z)) {
        const patch = Math.sin(x * 0.53) + Math.cos(y * 0.62);
        if (patch > 0.35 && rand() < 0.76) {
          set(x, y, z + 1, rand() < 0.45 ? "#718c55" : "#526d49");
          if (rand() < 0.09) set(x, y, z + 2, "#92a967");
        }
        break;
      }
    }
  }
}

const mushrooms = [
  { x: 24, y: 22, foot: 7, base: 30, rx: 9, ry: 8, height: 9, lean: 2, tint: "teal" },
  { x: 13, y: 22, foot: 6, base: 23, rx: 7, ry: 6, height: 7, lean: -1, tint: "violet" },
  { x: 35, y: 27, foot: 6, base: 25, rx: 7, ry: 6, height: 7, lean: 1, tint: "violet" },
  { x: 25, y: 34, foot: 7, base: 20, rx: 5, ry: 5, height: 6, lean: 0, tint: "teal" },
  { x: 33, y: 14, foot: 6, base: 16, rx: 4, ry: 4, height: 5, lean: -1, tint: "violet" }
];

// Rounded ivory stems, with a warm shadow and a pale front highlight.
for (const m of mushrooms) {
  const lowerX = m.x + m.lean;
  ellipsoid(lowerX, m.y, m.foot + 1, 3, 3, 2, "#a7a895");
  line(lowerX, m.y, m.foot + 1, m.x, m.y, m.base, 2, "#bdc4af");
  line(lowerX - 1, m.y - 2, m.foot + 2,
       m.x - 1, m.y - 2, m.base - 2, 0, "#f0eacb");
  ellipsoid(m.x, m.y, m.base - 1, 3, 2, 2, "#d6dac2");

  // The darker, ribbed underside remains visible below the luminous cap.
  ellipsoid(m.x, m.y, m.base, m.rx - 1, m.ry - 1, 1,
            m.tint === "teal" ? "#285f68" : "#594070");
  for (let a = 0; a < 12; a++) {
    const angle = a * Math.PI / 6;
    line(m.x + Math.cos(angle) * 2, m.y + Math.sin(angle) * 2, m.base - 1,
         m.x + Math.cos(angle) * (m.rx - 1),
         m.y + Math.sin(angle) * (m.ry - 1), m.base,
         0, m.tint === "teal" ? "#80c7b9" : "#bb8fd0");
  }
}

// All five caps belong to the color-cycling magical part.
part("caps", [24, 23, 27]);
for (const m of mushrooms) {
  for (let dz = 0; dz <= m.height; dz++) {
    const t = dz / m.height;
    const width = t < 0.22
      ? 0.88 + 0.12 * (t / 0.22)
      : Math.sqrt(Math.max(0, 1 - ((t - 0.22) / 0.82) ** 2));
    for (let dx = -m.rx; dx <= m.rx; dx++) {
      for (let dy = -m.ry; dy <= m.ry; dy++) {
        const edge = (dx / (m.rx * width)) ** 2 +
                     (dy / (m.ry * width)) ** 2;
        if (edge <= 1) {
          const color = m.tint === "teal"
            ? (dz < 2 ? "#148b91" : rand() < 0.18 ? "#63e9d7" : "#25c7bf")
            : (dz < 2 ? "#76409b" : rand() < 0.18 ? "#e176df" : "#b45bcb");
          set(m.x + dx, m.y + dy, m.base + dz, color);
        }
      }
    }
  }
}
animate("caps", {
  type: "colors",
  palette: ["#27d6c5", "#b45be3", "#67f3ef"],
  pattern: "pulse",
  glow: 0.9
});

part("body");

// Light, oversized spots sit on top of the glowing caps.
const spots = [
  [-0.56, -0.28], [0.35, -0.46], [0.63, 0.12],
  [-0.19, 0.25], [0.08, -0.08], [-0.72, 0.14]
];
for (const m of mushrooms) {
  for (let i = 0; i < spots.length; i++) {
    const dx = Math.round(spots[i][0] * m.rx);
    const dy = Math.round(spots[i][1] * m.ry);
    let top = m.base;
    for (let z = m.base + m.height; z >= m.base; z--) {
      if (get(m.x + dx, m.y + dy, z)) {
        top = z;
        break;
      }
    }
    const pale = m.tint === "teal" ? "#d6fff1" : "#ffe1fa";
    set(m.x + dx, m.y + dy, top + 1, pale);
    if (i % 2 === 0) set(m.x + dx + 1, m.y + dy, top + 1, pale);
  }

  // A few bright beads along each near-facing brim.
  for (let dx = -m.rx + 2; dx <= m.rx - 2; dx += 3) {
    const dy = -Math.round(m.ry * Math.sqrt(1 - (dx / m.rx) ** 2));
    set(m.x + dx, m.y + dy, m.base + 1,
        m.tint === "teal" ? "#a0fff0" : "#f5a5f2");
  }
}

// Tiny companion mushrooms nestled in the moss.
for (const [x, y, z] of [[10, 31, 6], [39, 19, 5], [17, 36, 7], [29, 12, 6]]) {
  cylinder(x, y, z, 1, 3, "#e0d7b3");
  ellipsoid(x, y, z + 3, 3, 2, 2, "#ad73b9");
  set(x, y - 1, z + 4, "#ffe5f2");
}

// Soft little moss sprouts and scattered magic motes.
for (let i = 0; i < 26; i++) {
  const x = 9 + Math.floor(rand() * 31);
  const y = 12 + Math.floor(rand() * 25);
  for (let z = 10; z >= 3; z--) {
    if (get(x, y, z)) {
      if (z < 9 && rand() < 0.65) {
        set(x, y, z + 1, "#83a65e");
        if (rand() < 0.4) set(x, y, z + 2, "#a4bd73");
      }
      break;
    }
  }
}
for (const [x, y, z, c] of [
  [9, 17, 25, "#9bfff0"], [17, 14, 33, "#dba2ff"],
  [38, 18, 34, "#a8fff0"], [40, 32, 24, "#e9b5ff"],
  [20, 36, 31, "#83f4e0"], [31, 11, 24, "#edafff"]
]) set(x, y, z, c);