- mainImage
- -
- iTime
- -
- iResolution
- -
- source lines
- -
- emitted lines
- -
- conversions
- -
ShaderToyDecoder maps mainImage coordinates and uniforms before TSLEncoder emits executable JavaScript.
ShaderToy programs describe mainImage() in GLSL. This lab decodes that contract, emits executable TSL, and blends two live shader nodes while exposing the original uniforms and a direct WebGL2 reference.
Creating ShaderToy nodes and the full-screen surface.
ShaderToyDecoder maps mainImage coordinates and uniforms before TSLEncoder emits executable JavaScript.
The material selects shader A, shader B, or a TSL mix driven by the live blend uniform.
The ShaderToy node path is WebGPU-only here; WebGL2 runs the original GLSL in a ShaderMaterial.
mainImage and its coordinate contract become a callable function.
GLSL operators and uniforms become JavaScript TSL source.
Two independent ShaderToy nodes can blend inside a material graph.
The full-screen quad stays ordinary Three.js scene content.
Switch shader pairs and output policy, then measure the active full-screen path.
This is a deterministic adaptation of the official ShaderToy example: local shader programs replace the credited external artwork, while the ShaderToyDecoder, TSLEncoder, mainImage, iTime, iResolution, and node-material contracts remain executable.
Sources: official ShaderToy example · TSL · ShaderToyDecoder source · TSLEncoder source