Software Dino Walk
Dino Walk
A Yoshi-inspired dinosaur assembled entirely from scaled copies of one cube, walking a looping path across a textured ground plane. Every limb, the head, and the tail move through a hierarchical model.
Loading textures…
How it works
The dinosaur is a tree of parts. Each part has a local transform and a draw routine, and the scene walks the tree with a matrix stack so every child inherits the movement of its parent.
- One prototype. The torso, head, snout, arms, legs, feet, tail, red shell, and the ground plane are all instances of the same 36-vertex unit cube, scaled and positioned per part.
- Hierarchical model. Eleven nodes are linked by child and sibling references. Rotating a leg also carries its foot; rotating the head carries the snout.
- Procedural motion. Joint angles come from sine waves: arms and legs swing in opposite phase, the feet lift, the head bobs, and the tail wags, while the shell rides along on the torso.
- A looping path. The dinosaur's position follows a closed parametric curve, and its heading is taken from the curve's direction of travel, so it always faces where it is going.
- Textures. The dinosaur's skin texture is generated in code at startup and applied as a decal over the lit color. The ground uses a grass image, modulated by the lighting. Both use mipmaps and repeat wrapping.
- Lighting. A Blinn-Phong lighting model runs in the vertex shader, with a normal matrix keeping normals correct under each part's non-uniform scale.
Concepts
- Hierarchical modeling
- Matrix stack
- Texture mapping
- Procedural textures
- Blinn-Phong lighting
- Path animation
Built with
- WebGL
- GLSL
- JavaScript
Model hierarchy
- Torso
- Head
- Snout
- Left arm
- Right arm
- Shell
- Left leg
- Left foot
- Right leg
- Right foot
- Tail
- Head
Background
Written for CSE 470, Introduction to Computer Graphics, at Arizona State University, building on the course’s figure, lighting, and texture example programs. Uses the course-supplied webgl-utils and MV.js helper libraries. The grass ground texture was supplied with the course materials.