File: Transpiler.md | Updated: 11/15/2025
A class that transpiles shader code from one language into another.
Transpiler can only be used to convert GLSL into TSL right now. It is intended to support developers when they want to migrate their custom materials from the current to the new node-based material system.
Transpiler is an addon, and must be imported explicitly, see Installation#Addons.
import Transpiler from 'three/addons/transpiler/Transpiler.js';
Constructs a new transpiler.
decoder | The GLSL decoder.
---|---
encoder | The TSL encoder.
The GLSL decoder. This component parse GLSL and produces a language-independent AST for further processing.
The TSL encoder. It takes the AST and emits TSL code.
The linker. It processes the AST and resolves variable and function references, ensuring that all dependencies are properly linked.
Parses the given GLSL source and returns TSL syntax.
source | The GLSL source.
---|---
Returns: The TSL code.