LUNAR PARADOX← STUDIO

Technical Direction & Frame Budget Case Studies

Concrete DevTools diagnostics, draw-call reductions, and memory leak profiling from high-throughput WebGL, Three.js, and WebGPU runtimes.

Case Study 01 // Mobile Safari Frame Pacing

Eliminating 120ms Garbage Collection Freezes on Mobile Safari

During a high-concurrency 3D product reveal, mobile iOS Safari was dropping from 60 FPS to 14 FPS every 4 seconds. DevTools CPU profiling revealed that temporary THREE.Vector3, matrix allocations, and raycaster queries inside the render loop were triggering brutal Minor GC passes.

120ms → 0ms
GC Jitter Pauses
14 FPS → 60 FPS
Mobile iOS Sustained
0 KB/frame
Heap Allocation Delta
BEFORE: Garbage Collection Spikes (Every 4.1s) 124ms Minor GC Freeze [14 FPS]
AFTER: Static Scratch Registers & Ring Buffer Caches 16.6ms Flat Frame Budget [60 FPS Locked]

Technical Solution: Refactored the animation pipeline to use static module-level scratch registers and pre-allocated typed arrays (Float32Array). Replaced object instantiation with procedural ring-buffer caches, reducing heap churn during continuous user interaction to absolute zero.

Case Study 02 // Draw Call & GPU Fill-Rate Optimization

Collapsing 180 Draw Calls into 2 Instanced Render Passes

A client spatial visualization scene choked mid-range Android devices due to driver overhead from 180 individual Three.js mesh draw calls with separate material bindings and alpha test passes.

180 → 2
GPU Draw Calls
-68%
Battery Thermal Throttling
1.8ms
Render Thread Frame Time

Technical Solution: Consolidated fragmented geometry into InstancedMesh buffers using custom vertex shader unpackers for per-instance matrix and color modulation. Merged PBR roughness/metalness textures into single channel-packed ORM textures, eliminating material swaps entirely.

Case Study 03 // WebGPU Architecture & Feasibility

60 FPS Continuum Fracture Simulation on Consumer GPUs

Engineering a real-time bilinear cohesive zone fracture model with 240 steps/sec discrete strain integration running purely in-browser.

240 Hz
Physics Sub-Step Rate
100%
Zero-Server Client Execution
<25 MB
Total Asset Footprint

Technical Solution: Decoupled high-frequency physics stepping from the display refresh rate using critically damped spring-damper integration. Rendered via custom separable Gaussian bloom and physical depth-of-field shaders.

Case Study 04 // In-Browser Transformer KV-Cache Architecture

Slashing WebGPU VRAM Fragmentation from 68% – 85% to 3.8% with PagedAttention

Serving large language models natively in client-side WebGPU environments faced catastrophic Out-Of-Memory (OOM) failures on devices with bounded unified memory. Standard contiguous tensor allocations reserved worst-case sequence lengths upfront, leaving 68% – 85% of allocated VRAM locked in unpopulated padding buffers.

68% – 85% → 3.8%
VRAM Fragmentation
6× Throughput
Concurrent Stream Density
< 10⁻⁵
PyTorch Math Error (ε)
BEFORE: Contiguous VRAM Allocation (Worst-Case Pre-Alloc) 256 MB / 8 Streams [85.3% Waste]
AFTER: Non-Contiguous Page Tables & WGSL SRAM Tiling 38.25 MB / 8 Streams [3.8% Waste · 60+ Concurrent]

Technical Solution: Implemented operating-system-style virtual memory paging and block-tiled FlashAttention-2 online softmax entirely in pure WGSL compute shaders. Key-Value tensors are partitioned into non-contiguous 16-token physical page blocks indexed dynamically via lookup tables, eliminating allocation locks and enabling zero-copy prefix sharing across parallel conversation streams.

Case Study 05 // Real-Time Global Illumination

Hierarchical Radiance Cascades: Real-Time Dynamic GI in 0.56ms Without Denoising

Real-time path tracing in WebGL/WebGPU typically demands heavy temporal accumulation and spatial blur denoisers to mitigate extreme Monte Carlo stochastic noise, leading to persistent trailing artifacts, smear under camera motion, and 16ms+ render budgets that drop below 60 FPS.

16.4ms → 0.56ms
Compute Pass Budget
0 Trailing
Temporal Motion Smear
Infinite
Light Bounce Transport

Technical Solution: Formulated a hierarchical radiance cascade compute pipeline decomposing light transport into spherical angular intervals with dyadic spatial-angular scaling. Merged top-down via bilinear interpolation in WebGPU compute passes, yielding smooth diffuse penumbras and multi-bounce light transport with zero temporal ghosting and zero ray tracing noise.

Inspect your own 3D assets or explore the live WebGPU R&D

Run client-side frame and .GLB diagnostics in Frame & GLB X-Ray, or explore PagedAttention, Radiance Cascades, and continuum fracture simulations in Lunar Paradox Labs.

OPEN FRAME & GLB X-RAY ↗ EXPLORE LABS R&D ↗