fogón

← Nature3D assetfogon/hongos

Hongos

by fogonCC010321 blocks
HongosDrag to turn it
// «Hongos» · gpt-6-sol (medium)
// A cluster of three cartoon mushrooms of different sizes: red caps with white spots on thick cream stems, plus a tiny brown one.

// A little grassy patch keeps the cluster together without hiding the stems.
for (let x = 2; x <= 45; x++) {
  for (let y = 7; y <= 42; y++) {
    const q = ((x - 24) / 21) ** 2 + ((y - 25) / 17) ** 2;
    if (q < 0.88 + rand() * 0.22) {
      set(x, y, 0, rand() < 0.16 ? "#79c947" : rand() < 0.45 ? "#58ae39" : "#68bd3e");
      if (q > 0.45 && rand() < 0.07) set(x, y, 1, "#83d452");
    }
  }
}

function mushroom(cx, cy, rim, rx, ry, dome, stemR, spots, brown = false) {
  // Thick, slightly flared cream stalk.
  for (let z = 0; z <= rim + 1; z++) {
    const flare = z < 4 ? (4 - z) * 0.16 : 0;
    const r = stemR + flare - z * 0.012;
    for (let x = Math.floor(cx - r - 1); x <= cx + r + 1; x++) {
      for (let y = Math.floor(cy - r - 1); y <= cy + r + 1; y++) {
        if (((x - cx) / r) ** 2 + ((y - cy) / (r * 0.89)) ** 2 > 1) continue;
        let c = brown ? "#dfb67b" : "#f5e8c5";
        if (y > cy + 0.5 || x > cx + r * 0.45) c = brown ? "#b98651" : "#dac69f";
        if (y < cy - r * 0.35 && rand() < 0.78) c = brown ? "#f3d49a" : "#fff5d9";
        if (rand() < 0.055) c = brown ? "#c99960" : "#e8d6ae";
        set(x, y, z, c);
      }
    }
  }

  // Pale, flat underside and a broad, rounded cap.
  for (let x = Math.floor(cx - rx); x <= cx + rx; x++) {
    for (let y = Math.floor(cy - ry); y <= cy + ry; y++) {
      const q = ((x - cx) / rx) ** 2 + ((y - cy) / ry) ** 2;
      if (q > 1) continue;
      if (q < 0.87) {
        set(x, y, rim - 1, brown ? "#d7a76b" :
            q > 0.40 ? "#e9cda7" : "#fff0cd");
      }

      const top = rim + 1 + Math.round(dome * Math.sqrt(1 - q));
      for (let z = rim; z <= top; z++) {
        let c;
        if (brown) {
          c = z <= rim + 1 ? "#714027" :
              z > rim + dome * 0.68 ? "#c78749" : "#a96738";
        } else {
          c = z <= rim + 1 ? "#a92830" :
              z < rim + 4 ? "#d73239" :
              z > rim + dome * 0.67 ? "#fa5448" : "#e9403d";
          if (z > rim + 3 && rand() < 0.11) c = "#ff6755";
        }
        set(x, y, z, c);
      }

      // Spots follow the curved surface, rather than floating in a plane.
      if (!brown) {
        for (const [sx, sy, sr] of spots) {
          const d = ((x - (cx + sx * rx)) / (sr * rx)) ** 2 +
                    ((y - (cy + sy * ry)) / (sr * ry)) ** 2;
          if (d < 1 && q < 0.92) {
            const white = d < 0.53 ? "#fffdf0" : "#f7e8d0";
            set(x, y, top, white);
            if (d < 0.58) set(x, y, top + 1, white);
            if (q > 0.57) set(x, y, top - 1, "#f7e8d0");
          }
        }
      } else if (q < 0.6 && rand() < 0.11) {
        set(x, y, top, "#d99b5a");
      }
    }
  }
}

// The smaller caps sit at different heights around the tall centerpiece.
mushroom(9, 18, 15, 8, 7, 9, 2.8, [
  [-0.55, -0.22, 0.17], [0.08, -0.57, 0.15],
  [0.44, -0.12, 0.17], [-0.16, 0.28, 0.17],
  [0.46, 0.46, 0.12], [-0.65, 0.38, 0.12]
]);
mushroom(37, 31, 13, 7, 7, 8, 2.6, [
  [-0.48, -0.37, 0.17], [0.30, -0.49, 0.16],
  [0.49, 0.12, 0.16], [-0.23, 0.29, 0.18],
  [0.22, 0.55, 0.11]
]);
mushroom(12, 35, 7, 4, 4, 4, 1.5, [], true);
mushroom(25, 24, 22, 12, 11, 12, 4.1, [
  [-0.64, -0.32, 0.15], [-0.21, -0.61, 0.17],
  [0.38, -0.58, 0.16], [0.69, -0.17, 0.13],
  [0.12, -0.17, 0.15], [-0.49, 0.19, 0.17],
  [0.37, 0.27, 0.18], [-0.11, 0.52, 0.16],
  [0.61, 0.53, 0.11], [-0.62, 0.60, 0.10]
]);

// A few grass blades and storybook wildflowers around the feet.
const tufts = [[5, 26], [7, 32], [17, 12], [19, 36], [29, 38],
               [33, 12], [42, 23], [40, 39], [4, 19], [23, 9]];
for (const [x, y] of tufts) {
  box(x, y, 0, x, y, 2, "#4ca638");
  set(x - 1, y, 1, "#7dce48");
  set(x + 1, y + 1, 1, "#67bd3d");
}

const flowers = [
  [6, 37, "#ffe66c"], [18, 40, "#9bcaff"],
  [35, 40, "#ffd16c"], [42, 16, "#e5a4f2"],
  [16, 9, "#fff6a1"], [39, 11, "#a9d4ff"]
];
for (const [x, y, petal] of flowers) {
  set(x, y, 1, "#3c963d");
  set(x, y, 2, "#4cad42");
  set(x, y, 3, "#f6b946");
  set(x - 1, y, 3, petal);
  set(x + 1, y, 3, petal);
  set(x, y - 1, 3, petal);
  set(x, y + 1, 3, petal);
}