WEBGL STUDY / MATERIAL PATCHING

A material can rewrite the vertex stage.

`onBeforeCompile` lets a built-in material keep its lighting and normal pipeline while a small patch injects time-varying twist math. Separate cache keys keep opposite shader variants from sharing the wrong program.

Preparing study—

Creating two patched MeshNormalMaterial variants…

The official Lee Perry-Smith GLB is replaced with a procedural sphere. The material patch and cache-key lifecycle remain the lesson; this lab makes no asset or pixel-parity claim.

THREE.JS FOUNDATIONS / PATCH THE PIPELINE, OWN THE KEY