Optional
attributesObject detailing the mapping of vertex shader attribute names to semantics SEMANTIC_*. This enables the engine to match vertex buffer data as inputs to the shader. Defaults to undefined, which generates the default attributes.
Optional
fragmentGLSLThe fragment shader code in GLSL.
Optional
fragmentFragment shader output types, which default to vec4. Passing a string will set the output type for all color attachments. Passing an array will set the output type for each color attachment.
Optional
fragmentWGSLThe fragment shader code in WGSL.
Unique name for the shader. If a shader with this name already exists, it will be returned instead of a new shader instance.
Optional
vertexGLSLThe vertex shader code in GLSL.
Optional
vertexWGSLThe vertex shader code in WGSL.
Defines the vertex and fragment shader source for ShaderMaterial, supporting both GLSL and WGSL formats. WebGL always uses the GLSL code. WebGPU prefers the WGSL code if available, otherwise it automatically transpiles the provided GLSL code at runtime.