Technical Retrospective WebGL & GLSL Shaders AI Development Benchmark

Whiskers Build - Architecture & Framework Benchmark

An engineering breakdown of a browser-native, hardware-accelerated projection mapping suite created with ZIM, WebGL, and generative AI collaboration.

4 – 5 Days
Actual Delivery Time
AI-Assisted in Google AI Studio
3 – 5 Weeks
Solo Human Baseline
Senior Graphics Engineer (No AI)
~2.7M
Total Token Volume
18 Chats @ ~150k Tokens Avg
60 FPS
Real-Time Performance
Zero-Copy GPU Video & Shader Blends

What is Whiskers?

Whiskers is a code-defined projection mapping tool built on the ZIM JavaScript Canvas Framework. Unlike static mapping software, Whiskers allows developers and artists to load videos, images, SVGs, and interactive generative code (particle emitters, sound visualizers, animated shapes, ML5 webcam tracking) directly into projection surfaces.

Surfaces are passed into Perspective() and mapped via ProjectionMap(), providing real-time hardware homography warping, dynamic passthrough cropping, multi-mode Bezier masking, GPU Gaussian feathering, multi-layer composite blending, undo/redo history, presentation mode, and full-stage calibration crosshairs.

10 Core Architectural Features of Whiskers

01 • Ingestion Pipeline

Hardware Video & Generative Content

Direct HTML5 video element piping to WebGL textures without 2D canvas readback bottlenecks. Simultaneously supports interactive ZIM containers, vector shapes, physics simulations, sound-wave animations, and live particle Emitter objects.

02 • GPU Homography

Projective Quad Warping & Fill-Rate Scaling

Real-time 4-point projective homography mapping. Features selectable texture resolution scaling: 1.0 for native 1:1 pixel crispness, 0.5 for bilinear filtering with a 75% GPU fragment fill-rate savings, and 2.0+ for Retina supersampling.

03 • Passthrough Engine

Dynamic Boundary Cropping & Shifting

Integrated Crop Passthrough mode allowing non-warped content to be framed within the perspective bounds. Features independent real-time content scaling (0.2× – 3.0×) and horizontal/vertical pixel translation offsets (±100px).

04 • Vector Mask Rig

Multi-Mode Cubic Bezier Editor

Stage-level Bezier mask (Blob) supporting 5 curvature modalities (mirror, straight, free, none/corner), vertex insertion, deletion, multi-point selection, and precision keyboard arrow nudging (1px normal / 10px shift).

05 • Multi-Pass GLSL

GPUMaskEngine with Anti-Banding Dither

3-Pass WebGL pipeline: Canvas rasterization → Horizontal Gaussian Blur → Aspect-corrected Vertical Blur → Smoothstep alpha ramp with Interleaved Gradient Noise (IGN) dithering to eliminate 8-bit quantization banding on dark projector beams.

06 • Stacking & Compositing

Layer Ranking & 8 Canvas Blend Modes

Retained-mode z-index rank manipulation with instant reordering across parent containers. Supports 8 hardware compositing modes: normal, lighten, darken, screen, multiply, add, color burn, and difference.

07 • Optical Geometry

Vanishing-Point Calibration Crosshairs

Snapping crosshair reticle calculating the true optical perspective center via diagonal line-line intersection (p0→p2 × p1→p3), accurately following non-linear perspective foreshortening live at 60 FPS across dragging and key nudges.

08 • State & Persistence

Dual-Tier Undo/Redo & JSON Serialization

50-step deep undo/redo snapshot stack (Ctrl+Z / Ctrl+Y). Complete session state auto-saved to localStorage per project ID, paired with an integrated JSON Import/Export modal pane for cross-machine deployment.

09 • Canvas-Native GUI

Responsive Glassmorphic Control Panel

Single display-tree UI built with nested Tile layouts, steppers, sliders, check boxes, and dynamic status-colored borders (red for locked, yellow for hidden, orange for both), collapsible and draggable across the canvas.

10 • Staging & Performance

Presentation Mode & Stage Blackout

Instant distraction-free Presentation mode (P key / double-click) stripping away handles, crosshairs, and panels for live shows, combined with a smooth-animated stage blackout overlay (Space bar).

Multi-Framework AI Development Benchmark

A breakdown of how this exact project would have progressed using AI collaboration across other popular frameworks and ecosystems, accounting for helper libraries, training data representation, and architectural friction.

Alternative A PixiJS (+ pixi-projection)
Est. Dev Time: 5 – 7 Days
Est. Tokens: ~3.5M (22 Chats)

Analysis: PixiJS is the closest 2D WebGL architecture to ZIM. The community plugin pixi-projection handles 2D quad perspective smoothly, and Pixi's sprite/filter pipeline is fast. However, Pixi lacks an interactive Bezier curve editor (no Blob equivalent), requiring the AI to author custom vector handle rigs, hit testing, and drag mechanics using PIXI.Graphics.

Available Out-of-the-Box
  • High-performance 2D WebGL rendering engine
  • pixi-projection plugin for 2D quad warping
  • Multi-pass filter pipeline (AlphaMaskFilter, Gaussian blur)
AI Friction & Bottlenecks
  • No interactive Bezier path editor; custom handle math needed
  • UI library (@pixi/ui) is rudimentary; likely requires HTML DOM overlay
Alternative B React + Three.js / WebGL + Tweakpane
Est. Dev Time: 6 – 8 Days
Est. Tokens: ~4.0M (26 Chats)

Analysis: Benefit from the largest AI training dataset in existence. State management, undo/redo stacks, JSON serialization, and UI panels (via Tweakpane/MUI) are generated effortlessly. The major bottleneck is the **declarative vs. imperative impedance mismatch**: syncing 60 FPS canvas mouse dragging across React state cycles causes frame drops unless bypassed with raw refs, and syncing 2D Bezier overlays across 3D normalized device coordinates (NDC) requires significant boilerplate.

Available Out-of-the-Box
  • Vast AI knowledge base; flawless state machines
  • Instant control panel creation via Tweakpane or Leva
  • Three.js hardware shader & video texture support
AI Friction & Bottlenecks
  • Declarative state re-renders clash with 60 FPS handle dragging
  • Projective 2D quad mapping in 3D requires custom homography shaders
  • Syncing 2D screen-space Bezier handles with 3D camera projection
Alternative C Flutter (Flutter Web)
Est. Dev Time: 10 – 14 Days
Est. Tokens: ~5.5M (36 Chats)

Analysis: Flutter's Material widget library creates the control panel, steppers, and sliders on Day 1. However, Flutter Web has severe architectural friction with low-level WebGL multi-pass FBO rendering. Chaining multiple custom fragment shaders to blur a dynamic Bezier mask and compositing that over a hardware video stream on the Web encounters frequent browser platform bugs.

Available Out-of-the-Box
  • Industry-leading UI component toolkit and layout system
  • Typed matrix transformations (Matrix4)
AI Friction & Bottlenecks
  • Multi-pass FBO render-to-texture shaders on Web are poorly supported
  • Must write custom vector handle drag math in CustomPainter
  • LLM frequently hallucinates unsupported WebGL pipeline hooks
Alternative D p5.js (Processing Web)
Est. Dev Time: 10 – 12 Days
Est. Tokens: ~5.0M (34 Chats)

Analysis: Excellent for single-canvas creative coding and simple shader experiments. However, p5.js is an **immediate-mode** engine (everything is redrawn inside draw()). Whiskers is an advanced **retained-mode** application. In immediate mode, there is no display hierarchy, no event bubbling on individual shapes, and no coordinate inheritance. The AI has to write a custom object manager, hit-testing engine, and drag system from scratch.

Available Out-of-the-Box
  • Simple shader creation with createShader()
  • Fast setup for creative visuals and math experimentation
AI Friction & Bottlenecks
  • Immediate-mode architecture lacks display tree and event bubbling
  • No built-in vector handle rig or component coordinate spaces
  • UI library (p5.gui) is inadequate for multi-surface controls
Alternative E Raw JavaScript (Canvas 2D + WebGL)
Est. Dev Time: 14 – 18 Days
Est. Tokens: ~8.0M (50+ Chats)

Analysis: Complete control over every GPU state and byte with zero dependencies. The AI writes GLSL shaders, matrix math, and FBO buffers easily. However, having no framework means the AI must author an entire retained scene graph, matrix hierarchy, event dispatchers, vector hit-testing, cubic Bezier curve evaluation, and UI widgets from scratch. The codebase rapidly explodes in size, triggering AI context degradation.

Available Out-of-the-Box
  • Zero dependencies, minimal bundle size, full GPU access
  • Pure algorithmic freedom for GLSL and matrix math
AI Friction & Bottlenecks
  • Must build scene graph, hit tests, and handle lifecycles from scratch
  • Must author every UI slider, stepper, panel, and dialog manually
  • Massive codebase causes prompt context bloat and hallucinations

Master Benchmark Matrix

Framework / Stack Dev Time (AI) Token Burn Native Projection Native Bezier Rig Integrated Canvas UI Primary Architectural Bottleneck
ZIM (Actual) 4 – 5 Days ~2.7M Built-in Built-in Built-in Smaller training corpus; solution master system prompt.
PixiJS (+ pixi-projection) 5 – 7
Days
~3.5M Plugin None Minimal Lacks interactive Bezier curve editor; UI requires DOM overlay.
React + Three.js 6 – 8
Days
~4.0M Custom Shader None DOM (Tweakpane) Declarative vs. 60 FPS direct-manipulation drag impedance.
p5.js 10 – 12 Days ~5.0M Custom Shader None None Immediate-mode architecture lacks retained scene tree and event bubbling.
Flutter Web 10 – 14 Days ~5.5M Custom Shader None Built-in Multi-pass WebGL FBO shader pipeline is poorly supported on Web.
Raw JS (Canvas/WebGL) 14 – 18 Days ~8.0M None None None Must author entire scene graph, math, UI, and event system from scratch.

4 Key Takeaways for AI-Assisted Development

The Law of Semantic Density in AI Collaboration

Prompting velocity is not determined by how much code an LLM can generate, but by how much functionality the framework solves natively in single compound classes. When an engine bundles perspective warping, interactive Beziers, and UI components into a shared coordinate space, the AI spends its attention budget solving application logic rather than reinventing foundational wheels.

1. The Architectural Boundary Pivot

When implementing complex GLSL shaders, isolating the raw multi-pass WebGL pipeline into a standalone GPUMaskEngine class was the turning point. It decoupled GPU framebuffers from the vector display list and prevented token-bloat hallucinations.

2. The 150k Token Context Reset

Large language models degrade in reasoning precision as conversation history expands past 150,000–250,000 tokens. Establishing modular handovers and starting fresh chats kept the AI in high-attention focus across all 18 development cycles.

3. Non-Invasive State Observation

Early bugs in the reticle/crosshair engine occurred because event listeners tried to mutate internal selection states (selectSide() / selectCorner()). Switching to 100% read-only geometric observation via localToGlobal(0,0) guaranteed zero handle separation.

4. Unified Retained-Mode Hierarchy

Having video textures, generative shapes, vector handles, and glassmorphic UI panels coexist within the same canvas hierarchy eliminated the multi-layer DOM-to-WebGL coordinate synchronization bugs common in other stacks.