Interface ShaderMaterial
interface ShaderMaterial {
attributes: readonly ShaderAttributeName[];
backFaceCulling: boolean;
blend?: GPUBlendState;
blendMode: "additive" | "alpha";
defines: readonly ShaderDefine[];
depthBias: number;
depthBiasSlopeScale: number;
depthCompare: GPUCompareFunction;
depthOnlyFragment: boolean;
depthWrite: boolean;
fragmentSource: WgslSource;
metadata?: LiteMetadata;
name?: string;
needAlphaBlending: boolean;
needAlphaTesting: boolean;
samplerDecls: readonly ShaderSamplerDecl[];
stencil?: StencilState;
storageBufferDecls: readonly ShaderStorageBufferDecl[];
transmissive: boolean;
uniformDecls: readonly ShaderUniformDecl[];
vertexSource: WgslSource;
}
attributes: readonly ShaderAttributeName[];
backFaceCulling: boolean;
blend?: GPUBlendState;
blendMode: "additive" | "alpha";
defines: readonly ShaderDefine[];
depthBias: number;
depthBiasSlopeScale: number;
depthCompare: GPUCompareFunction;
depthOnlyFragment: boolean;
depthWrite: boolean;
fragmentSource: WgslSource;
metadata?: LiteMetadata;
name?: string;
needAlphaBlending: boolean;
needAlphaTesting: boolean;
samplerDecls: readonly ShaderSamplerDecl[];
stencil?: StencilState;
storageBufferDecls: readonly ShaderStorageBufferDecl[];
transmissive: boolean;
uniformDecls: readonly ShaderUniformDecl[];
vertexSource: WgslSource;
}
Hierarchy (View Summary)
- Material
- ShaderMaterial
Properties
Readonlyattributes
Readonlyback Face Culling
backFaceCulling: boolean
Optional Readonlyblend
blend?: GPUBlendState
Explicit blend-state override (see ShaderMaterialOptions.blend).
Readonlyblend Mode
blendMode: "additive" | "alpha"
Readonlydefines
Readonlydepth Bias
depthBias: number
Readonlydepth Bias Slope Scale
depthBiasSlopeScale: number
Readonlydepth Compare
depthCompare: GPUCompareFunction
Readonlydepth Only Fragment
depthOnlyFragment: boolean
Readonlydepth Write
depthWrite: boolean
Readonlyfragment Source
fragmentSource: WgslSource
Optionalmetadata
User metadata. glTF loads populate metadata.gltf.extras when source extras exist.
Optional Readonlyname
name?: string
Optional human-readable name. Populated by loaders from the source asset (e.g. the glTF material name) so callers can look a material up by name.
Readonlyneed Alpha Blending
needAlphaBlending: boolean
Readonlyneed Alpha Testing
needAlphaTesting: boolean
Readonlysampler Decls
Optionalstencil
Optional stencil-test state baked into the main-pass pipeline (mask write / discard). Set after
creation (mat.stencil = { ... }) and call enableMaterialStencil() before registerScene. Default
none. See StencilState.
Readonlystorage Buffer Decls
storageBufferDecls: readonly ShaderStorageBufferDecl[]
Readonlytransmissive
transmissive: boolean
True for transmissive/refractive surfaces (see ShaderMaterialOptions.transmissive).
Readonlyuniform Decls
Readonlyvertex Source
vertexSource: WgslSource
A custom WGSL material: compiled from user-supplied vertex/fragment sources with declared attributes, uniforms, samplers, external textures, and defines. Update its values via
setShaderUniform()/setShaderTexture()and friends.