All AI Labs
WebGL InteractiveThree.js 3D·Interactive 3D

3D Microduck: Interactive Biped Robot Playground

Lutfi's own MicroDuck simulator design, live in the browser: a servo-built biped robot with real joint kinematics — walk, run, sit, jump, quack, free-roam steering, camera presets and synthesized sound.

Live Hardware-Accelerated Viewport

System Architecture & Engineering Concept

Microduck is a miniature bipedal robot with an oversized camera-eye head and a flat duck-bill beak, modeled faithfully after the physical micro biped robots in the reference photos. This build uses Lutfi's own MicroDuck 3D Simulator design: a PBR model assembled from rounded-box geometry with stacked servo blocks, neck wiring loops, CNC-style aluminum leg links, extruded thigh shield plates and chunky duck-boot feet — no external model files. A pure kinematics engine computes every joint pose (pelvis, neck, head, hips, knees, ankles) for idle, walk, run, sit and jump, with smooth pose blending between modes. Drive it two ways: Treadmill mode walks in place while the floor grid scrolls, and Free Roam mode lets you steer around the arena with WASD. Four studio color themes, four camera presets (Orbit, Follow, Head, Feet), a speed control, and a fully synthesized Web Audio soundscape — servo whirrs, footstep taps and a proper FM-synth quack — complete the simulator.

Mathematical Formulation / Heuristic:
Deterministic joint kinematics: each mode is a pure function pose = f(mode, time, speed) — e.g. walk hip swing theta_hip = A * sin(phi) with knee lift A * max(0, -cos(phi)) and ankle compensation -theta_hip - 0.6 * theta_knee; mode changes cross-fade with blendPoses(a, b, t) over 0.35 s. Free-roam locomotion integrates heading and velocity in the scene manager; contact flags on each foot trigger footstep audio exactly on ground strike.

Implementation Highlights

  • The robot model (MicroDuckRobot) is built from a custom rounded-box geometry generator plus extruded shield plates and tube-geometry neck cables, with PBR materials lit by a RoomEnvironment studio HDRI and ACES tone mapping.
  • Kinematics is a pure, unit-testable module: calculateDuckPose(mode, time, speed) returns a full 21-joint pose, and applyPose maps it onto the Three.js joint hierarchy — rendering and motion logic stay fully separated.
  • Scene manager handles pose-blend transitions, treadmill grid scrolling vs free-roam navigation, camera presets, FPS tracking, and a software-GL fallback path for GPU-less machines.
  • All sound is synthesized live with Web Audio (FM quack, servo whirr, noise-burst footsteps) — zero audio files; four color themes re-skin every material at runtime.

Interactive Parameters

Walk / Run / Sit / Jump
Motion modes with blended transitions — Run leans in hard, Sit folds into the seated pose from the photo, Jump runs a crouch-launch-land spring cycle
Treadmill / Free Roam
Treadmill walks in place on a scrolling grid; Free Roam drives the duck around the arena with W A S D / arrow keys
Camera Presets
Orbit freely, or jump to Follow (behind the duck), Head (close-up on the camera eye) and Feet (leg articulation close-up)
Themes & Speed
Four color themes — Sky, Cyber, Cream, Stealth — plus a 0.2x–3.0x speed multiplier for the gait engine
Quack & Shortcuts
Quack button (or Space / Q) fires the synthesized duck call; keys 1–4 switch Walk / Run / Sit / Idle
Core Engine LoopTypeScript
// Pure kinematics: walk gait (kinematics.ts)
const leftHip = Math.sin(phase) * hipSwingAmp;
const leftKnee = Math.max(0, -Math.cos(phase)) * kneeLiftAmp + 0.15;
const leftAnkle = -leftHip - leftKnee * 0.6 + (sinLeft > 0 ? 0.25 : -0.05);
// Mode changes cross-fade over 0.35s:
currentPose = blendPoses(prevPose, targetPose, transitionAlpha);
robot.applyPose(currentPose);