Skip to content

MaterialSpec

Type

MaterialSpec describes a material for Materials.DefineMaterial and Materials.GetMaterial.

Name

Field
Name: string

Name is 1 to 31 bytes, defaulting to the next unused "Material<n>".

Pipeline

Field
Pipeline: MaterialPipeline?

Pipeline is "Opaque", "Cutout", "Transparent", "Water", or "Decal" (MaterialPipeline). "Water" and "Decal" require Model "UV"; when Shader is set, Pipeline defaults to "Opaque" and allows "Opaque", "Cutout", or "Transparent".

Anchored "Water" parts are swimmable fluid volumes; unanchored "Water" parts stay solid.

Model

Field
Model: SurfaceModel?

Model is "UV", "Triplanar", or "Stud" (SurfaceModel), defaulting to "UV" when Shader is set.

Shader

Field
Shader: string?

Shader is a shader file name in shaders/ without .slang, or nil; see writing a material shader.

Blend

Field
Blend: MaterialBlend?

Blend is "Alpha" or "Additive" (MaterialBlend, default "Alpha"). Requires Shader; see transparent materials.

Faces

Field
Faces: MaterialFaces?

Faces is "Front", "Back", or "Both" (MaterialFaces, default "Front"). Requires Shader; see faces.

Params

Field
Params: { [string]: MaterialParamValue }?

Params maps up to 16 shader field names to numbers, vectors, booleans, or texture asset IDs, or is nil. Update values at runtime with Materials.SetParam.

Surface

Field
Surface: MaterialSurface?

Surface is the MaterialSurface table, optional when Shader is set.

Emission

Field
Emission: MaterialEmission?

Emission is the MaterialEmission table, or nil.

Studs

Field
Studs: MaterialStuds?

Studs is the MaterialStuds table when Model is "Stud", or nil.

Water

Field
Water: MaterialWater?

Water is the MaterialWater table when Pipeline is "Water", or nil.

Physics

Field
Physics: MaterialPhysics?

Physics is the MaterialPhysics table, or nil.

Footsteps

Field
Footsteps: MaterialAudio?

Footsteps is the MaterialAudio table for footsteps, or nil.

Impacts

Field
Impacts: MaterialAudio?

Impacts is the MaterialAudio table for impacts, or nil.