First Patch: Hydra Signal + 3D Scene

Use this patch to understand triode's two-layer model: signal chains and scene graph.

perspective([2, 2, 3], [0, 0, 0], {
  controls: { enabled: true, modifier: "none" },
});

const material = osc(6, 0.08, 0.7)
  .modulate(noise(2), 0.08)
  .rotateDeg(noise(1).mult(20))
  .phong({ shininess: 20 });

const sc = stage({ name: "main", reuse: true })
  .lights({ all: true })
  .world({ ground: true, fog: true })
  .mesh(geom.box(), material, { key: "hero-box" })
  .render();

update = () => {
  const box = sc.obj(0);
  if (!box) return;
  box.rotation.x += 0.008;
  box.rotation.y += 0.012;
};

Why this patch matters

  • osc(...).phong() bridges Hydra signals into a Three material.
  • stage() gives a chainable scene handle.
  • key helps object identity in liveMode: "continuous" during iterative edits.

Next