// === BUILD PLAN ===
// Subject: COLOSSAL WALRUS hauled out on a cracked ice floe (organic, ice biome, colossal)
// Axis: body runs along X, tail at x=12 -> nose at x=52 (40 long), centre z=32, ice top Y=10, belly Y=11
// Proportions (real walrus ~ length:height = 2.4:1): barrel r=8, chest r=7.5, neck r=5.5, head r=4
// -> length 40, max girth 16, head UP on the front flippers (lift ramp from x=36 to x=50)
//
// SIDE SILHOUETTE (X right, Y up):
// ..............____.... head lifted, muzzle + whiskers
// ___/ barrel / \
// / blubber | o | eye
// |_________________|__||__| || = the two ivory tusks going DOWN to the ice
// ~~~~~~~ ICE FLOE ~~~~~~~~~~
//
// FRONT CROSS-SECTION at the barrel (Y up, Z across):
// ######
// ##########
// ############ round blubber roll, flattened where it meets the ice
// ############
// ==== ice ====
//
// Y-AXIS CHECK: dy>0 = BACK/spine (top), dy<0 = BELLY (bottom). Belly clipped at Y=11 (rests on ice).
// MATERIALS PLAN:
// hide : gradientPalette brown_concrete(low/shadow) -> brown_terracotta -> terracotta(top light)
// - WHY: value ramp fakes the light on a huge round body; dark under the belly = AO
// folds : brown_concrete rings on the neck/shoulder shell cells - WHY: wrinkled walrus skin
// tusks : bone_block + end_rod tips - WHY: ivory, reads at distance
// floe : patches(snow_block/packed_ice/blue_ice) over packed ice - WHY: big blotches, not confetti
// sea : water over a gravel bed, ragged blob edge + crack channels
// === END PLAN ===
var CZ = 32, ICE = 10, BELLY = 11;
var XT = 12, XN = 52;
var x, y, z, i, w, t;
// ---------- palettes ----------
var hide = gradientPalette(BELLY, 30, [{block:'brown_concrete',from:0},{block:'brown_terracotta',from:0.42},{block:'terracotta',from:0.82}], {noise:0.26, seed:7});
var icePat = patches([{block:'snow_block',w:52},{block:'packed_ice',w:30},{block:'blue_ice',w:18}], 0.075, 5);
var bedPat = noisePalette([{block:'gravel',weight:50},{block:'stone',weight:30},{block:'sand',weight:20}], {seed:12, freq:0.2});
// ---------- 1. ARCTIC SEA ----------
fill(0, 0, 0, 63, 4, 63, bedPat);
fill(0, 5, 0, 63, 9, 63, b('water'));
var floe = blob(30, 32, 25, {irregularity:0.55, seed:19});
var flat = function (fx, fz) { return ICE; };
surface(floe, flat, function (fx, fz) { return icePat(fx, fz); }, {sub:'packed_ice', deep:'blue_ice', depth:3});
// smaller drift floes around
var floe2 = blob(9, 12, 7, {irregularity:0.6, seed:31});
surface(floe2, flat, function (fx, fz) { return icePat(fx, fz); }, {sub:'packed_ice', deep:'packed_ice', depth:2});
var floe3 = blob(55, 50, 6, {irregularity:0.6, seed:37});
surface(floe3, flat, function (fx, fz) { return icePat(fx, fz); }, {sub:'packed_ice', deep:'packed_ice', depth:2});
// cracks: two meltwater channels through the main floe
for (t = 0; t <= 60; t++) {
var cx1 = t, cz1 = Math.round(14 + 6 * Math.sin(t * 0.16));
var cx2 = Math.round(46 + 5 * Math.sin(t * 0.13)), cz2 = t;
for (w = -1; w <= 1; w++) {
if (floe(cx1, cz1 + w)) { pb(cx1, ICE, cz1 + w, 'water'); pb(cx1, ICE - 1, cz1 + w, 'water'); }
if (floe(cx2 + w, cz2)) { pb(cx2 + w, ICE, cz2, 'water'); pb(cx2 + w, ICE - 1, cz2, 'water'); }
}
}
// ---------- 2. BODY: elliptical slices along X ----------
function rzAt(px) {
if (px < 18) return 2.2 + (px - XT) * 0.55;
if (px < 30) return 5.5 + (px - 18) * 0.21;
if (px < 40) return 8.0 - (px - 30) * 0.11;
if (px < 46) return 6.9 - (px - 40) * 0.24;
return 5.5 - (px - 46) * 0.28;
}
function ryAt(px) {
if (px < 18) return 2.0 + (px - XT) * 0.5;
if (px < 30) return 5.0 + (px - 18) * 0.25;
if (px < 40) return 8.0 - (px - 30) * 0.06;
if (px < 46) return 7.4 - (px - 40) * 0.3;
return 5.6 - (px - 46) * 0.3;
}
function liftAt(px) { // head/chest propped UP on the front flippers
if (px < 34) return 0;
if (px < 50) return (px - 34) * 0.42;
return 6.7;
}
function bodyAt(px, py, pz) { // is this cell inside the blubber volume?
if (px < XT || px > XN) return false;
var rz = rzAt(px), ry = ryAt(px);
var cy = BELLY + ry + liftAt(px);
var dz = pz - CZ, dy = py - cy;
return ((dz * dz) / (rz * rz) + (dy * dy) / (ry * ry)) <= 1.0;
}
for (x = XT; x <= XN; x++) {
var rzv = rzAt(x), ryv = ryAt(x), cyv = Math.round(BELLY + ryv + liftAt(x));
for (z = CZ - Math.ceil(rzv); z <= CZ + Math.ceil(rzv); z++) {
for (y = Math.round(cyv - ryv); y <= Math.round(cyv + ryv); y++) {
if (y < BELLY) continue;
var ddz = z - CZ, ddy = y - cyv;
var q = (ddz * ddz) / (rzv * rzv) + (ddy * ddy) / (ryv * ryv);
if (q > 1.0) continue;
pb(x, y, z, hide(x, y, z));
}
}
}
// skin FOLDS: darker rings on the shell of the neck & shoulder (wrinkled walrus hide)
var foldX = [20, 33, 36, 39, 42, 45];
for (i = 0; i < foldX.length; i++) {
x = foldX[i];
var frz = rzAt(x), fry = ryAt(x), fcy = Math.round(BELLY + fry + liftAt(x));
for (z = CZ - Math.ceil(frz); z <= CZ + Math.ceil(frz); z++) for (y = BELLY; y <= fcy + Math.ceil(fry); y++) {
var dz2 = z - CZ, dy2 = y - fcy;
var q2 = (dz2 * dz2) / (frz * frz) + (dy2 * dy2) / (fry * fry);
if (q2 <= 1.0 && q2 >= 0.62) pb(x, y, z, 'brown_concrete');
}
}
// ---------- 3. HEAD: muzzle, whisker pads, eyes, whiskers ----------
var headCy = Math.round(BELLY + ryAt(50) + liftAt(50));
makeSphere(51, headCy - 1, CZ - 2, 'terracotta', 2.6, false);
makeSphere(51, headCy - 1, CZ + 2, 'terracotta', 2.6, false);
makeSphere(50, headCy + 1, CZ, 'brown_terracotta', 3.0, false);
pb(52, headCy + 3, CZ - 3, 'black_concrete'); pb(52, headCy + 3, CZ + 3, 'black_concrete');
pb(53, headCy + 3, CZ - 3, 'polished_blackstone'); pb(53, headCy + 3, CZ + 3, 'polished_blackstone');
// nostrils
ps(54, headCy + 1, CZ - 1, 'black_concrete'); ps(54, headCy + 1, CZ + 1, 'black_concrete');
// whiskers (end rods off the whisker pads)
for (i = 0; i < 6; i++) {
var wz = CZ - 4 + ((i % 3) * 3);
ps(54 + (i % 2), headCy - 1 - (i % 2), wz, 'end_rod[facing=east]');
}
// ---------- 4. TUSKS (ivory, pointing DOWN to the ice) ----------
function tusk(tz) {
var ty, tx, thick;
for (i = 0; i <= 9; i++) {
ty = headCy - 2 - i;
tx = 52 - Math.floor(i / 4);
thick = (i < 4) ? 1 : 0;
for (w = 0; w <= thick; w++) for (t = 0; t <= thick; t++) {
if (i < 8) pb(tx + w, ty, tz + t, (i < 6) ? 'bone_block[axis=y]' : 'smooth_quartz');
}
if (i === 8) pb(tx, ty, tz, 'smooth_quartz');
if (i === 9) ps(tx, ty, tz, 'end_rod[facing=down]');
}
}
tusk(CZ - 3); tusk(CZ + 2);
// ---------- 5. FLIPPERS ----------
// front flippers: prop the chest up, splayed onto the ice
function frontFlipper(side) {
var px, py, pz, k;
for (i = 0; i <= 9; i++) {
px = Math.round(38 + i * 0.85);
py = Math.round(18 - i * 0.78);
pz = Math.round(6 + i * 0.42);
if (py < BELLY) py = BELLY;
for (k = -1; k <= 1; k++) for (t = 0; t <= 1; t++) {
pb(px + k, py, CZ + side * (pz + t), hide(px, py, CZ + side * pz));
}
}
// toe-nails on the paddle edge
for (k = -1; k <= 1; k++) pb(47 + k, BELLY, CZ + side * 10, 'bone_block[axis=x]');
}
frontFlipper(1); frontFlipper(-1);
// rear flippers: fanned flat on the ice behind
function rearFlipper(side) {
var k, m;
for (k = 0; k <= 7; k++) for (m = 0; m <= 6; m++) {
var fx = 16 - k, fz = CZ + side * (2 + m);
if ((k * k) / 49 + (m * m) / 36 > 1.05) continue;
pb(fx, BELLY, fz, hide(fx, BELLY, fz));
if (k < 4 && m < 4) pb(fx, BELLY + 1, fz, hide(fx, BELLY + 1, fz));
}
for (m = 2; m <= 6; m += 2) ps(9, BELLY, CZ + side * m, 'brown_concrete');
}
rearFlipper(1); rearFlipper(-1);
// tail nub
makeSphere(13, BELLY + 2, CZ, 'brown_concrete', 2.2, false);
// ---------- 6. SNOW DRIFTS, ICE DETAIL, SCENE ----------
function onFloeFree(sx, sz) {
if (!floe(sx, sz)) return false;
var yy;
for (yy = BELLY; yy <= 34; yy++) if (bodyAt(sx, yy, sz)) return false;
return true;
}
for (x = 4; x < 60; x++) for (z = 4; z < 60; z++) {
var hsh = (x * 73856093 ^ z * 19349663) % 97;
if (hsh < 0) hsh = -hsh;
if (!onFloeFree(x, z)) continue;
if (hsh < 22) ps(x, BELLY, z, 'snow[layers=' + (1 + (hsh % 4)) + ']');
}
// pressure-ridge snow drifts
makeSphere(20, ICE, 48, noisePalette([{block:'snow_block',weight:70},{block:'powder_snow',weight:15},{block:'packed_ice',weight:15}], {seed:23}), 5.5, false);
makeSphere(44, ICE, 15, noisePalette([{block:'snow_block',weight:70},{block:'packed_ice',weight:30}], {seed:24}), 4.5, false);
makeSphere(12, ICE, 24, noisePalette([{block:'snow_block',weight:65},{block:'packed_ice',weight:35}], {seed:25}), 4.0, false);
// ice spikes on the far edge
for (i = 0; i < 5; i++) {
var sx2 = 50 - i * 3, sz2 = 55 - (i % 3) * 4;
if (!floe(sx2, sz2)) continue;
makeCone(sx2, BELLY, sz2, noisePalette([{block:'packed_ice',weight:60},{block:'blue_ice',weight:40}], {seed:26 + i}), 2.2, 5 + (i % 3), false);
}
// a couple of frozen kelp / driftwood props for scale
ps(24, BELLY, 15, 'stripped_spruce_log[axis=x]'); ps(25, BELLY, 15, 'stripped_spruce_log[axis=x]');
ps(26, BELLY, 15, 'stripped_spruce_log[axis=x]');