fogón

← AsiáticoObjeto 3Dfogon/bambu

Bambú

de fogonCC07098 bloques
BambúArrastrá para girarlo
// «Bambú» · gpt-6-sol (medium)
// A clump of bamboo: seven tall green stalks of different heights with lighter rings at the joints, small leaves in sprays near the tops, growing from a patch of grass and pebbles.

// A small garden patch beneath seven bamboo culms.
for (let x = 5; x <= 43; x++) {
  for (let y = 9; y <= 39; y++) {
    const d = ((x - 24) / 19) ** 2 + ((y - 24) / 15) ** 2;
    if (d > 1.08 || (d > 0.91 && rand() < 0.55)) continue;
    set(x, y, 0, d > 0.84 ? "#617047" : "#52683b");
    if (d < 0.92) set(x, y, 1, rand() < 0.3 ? "#79964b" : "#638341");
  }
}

// Pale pebbles, concentrated along the visible front edge.
for (const [x, y, r] of [
  [9, 31, 1.5], [15, 35, 1.2], [27, 36, 1.6],
  [38, 32, 1.3], [32, 11, 1.1], [8, 19, 1.2]
]) {
  ellipsoid(x, y, 1, r + 0.5, r, 1, "#9b9f91");
  set(x, y - 1, 2, "#d6d4ba");
  set(x + 1, y, 1, "#bfc2ad");
}

// Short blades around, but not over, the feet of the bamboo.
for (let i = 0; i < 125; i++) {
  const x = 7 + Math.floor(rand() * 35);
  const y = 11 + Math.floor(rand() * 27);
  if (!get(x, y, 1) || rand() < 0.28) continue;
  const h = 2 + Math.floor(rand() * 3);
  const c = rand() < 0.5 ? "#85a84c" : "#567d3d";
  line(x, y, 2, x + Math.floor(rand() * 3) - 1, y, h + 1, 0, c);
}

const bamboo = [
  { x: 11, y: 25, h: 38, r: 2.2, bx: -1, by:  0 },
  { x: 21, y: 29, h: 42, r: 2.5, bx:  0, by: -1 },
  { x: 34, y: 25, h: 35, r: 2.3, bx:  1, by:  0 },
  { x: 15, y: 16, h: 40, r: 2.2, bx: -1, by: -1 },
  { x: 27, y: 16, h: 44, r: 2.5, bx:  1, by:  0 },
  { x: 37, y: 17, h: 37, r: 2.1, bx:  1, by: -1 },
  { x: 24, y: 23, h: 33, r: 2.2, bx:  0, by:  1 }
];

function center(b, z) {
  return [
    b.x + Math.round(b.bx * z / b.h),
    b.y + Math.round(b.by * z / b.h)
  ];
}

for (const b of bamboo) {
  for (let z = 2; z <= b.h; z++) {
    const [cx, cy] = center(b, z);
    const joint = z > 3 && (z - 4) % 6 === 0;
    const groove = z > 3 && (z - 3) % 6 === 0;
    const rr = b.r + (joint ? 0.35 : 0);

    for (let dx = -3; dx <= 3; dx++) {
      for (let dy = -3; dy <= 3; dy++) {
        if (dx * dx + dy * dy > rr * rr) continue;
        let c;
        if (joint) c = dy < 0 ? "#c2d978" : "#90ac4d";
        else if (groove) c = "#375e34";
        else if (dx <= -1) c = "#396d3c";
        else if (dy < 0) c = rand() < 0.12 ? "#92bc66" : "#78a950";
        else c = rand() < 0.12 ? "#628e46" : "#538240";
        set(cx + dx, cy + dy, z, c);
      }
    }

    // A narrow sunlit stripe and the dark mark beneath each node.
    if (!joint && !groove && z < b.h - 1)
      set(cx + 1, cy - Math.round(b.r), z, "#a2c96b");
    if (groove) set(cx, cy - Math.round(b.r), z, "#294d33");
  }

  const [tx, ty] = center(b, b.h);
  set(tx, ty, b.h, "#30583a");
  set(tx + 1, ty, b.h, "#b5ce76");
}

// Pointed, individually readable lance-shaped leaves.
function leaf(x, y, z, dx, dy, rise, length, light) {
  const edge = light ? "#8dbb5a" : "#578c45";
  const spine = light ? "#b1d475" : "#73a94d";
  const px = -dy, py = dx;
  for (let i = 0; i <= length; i++) {
    const t = i / length;
    const xx = x + dx * i;
    const yy = y + dy * i;
    const zz = z + rise * t;
    set(xx, yy, zz, i === length ? edge : spine);
    if (i >= 2 && i <= length - 2) {
      set(xx + px, yy + py, zz, edge);
      if (i >= 3 && i <= length - 3)
        set(xx - px, yy - py, zz, light ? "#79a94f" : "#477b40");
    }
  }
}

for (let n = 0; n < bamboo.length; n++) {
  const b = bamboo[n];
  const outward = b.x < 21 ? -1 : b.x > 28 ? 1 : (n % 2 ? 1 : -1);

  for (let j = 0; j < 2; j++) {
    const z = b.h - 5 - j * 5;
    const [cx, cy] = center(b, z);
    const sx = outward * (j === 0 ? 1 : -1);
    const sy = j === 0 ? -1 : 1;
    const ex = cx + sx * (4 + j);
    const ey = cy + sy * 3;
    const ez = z + 2;
    line(cx, cy, z, ex, ey, ez, 0, "#426f3e");

    leaf(ex, ey, ez, sx, 0, 2, 6, j === 0);
    leaf(ex, ey, ez, sx, sy, 3, 5, true);
    if (j === 0) leaf(ex, ey, ez - 1, 0, sy, 1, 5, false);
  }

  const [tx, ty] = center(b, b.h - 2);
  leaf(tx, ty, b.h - 1, outward, -1, 2, 5, true);
}