ModelData:getMaterial

Returns a table with all of the properties of a material.


properties = ModelData:getMaterial(index)

Arguments

NameTypeDescription
indexnumber The index of a material.

Returns

NameTypeDescription
propertiestable The material properties.
.colortable The color of the material. The table contains the r, g, b, and a components of the color, from 0 to 1.
.glowtable The glow color of the material (sometimes called emissive). The table contains the r, g, and b components of the color from 0 to 1, and a fourth number indicating the strength of the glow.
.uvShifttable A table with 2 numbers indicating an offset to apply to UVs.
.uvScaletable A table with 2 numbers indicating a scale to apply to UVs. By default, shaders apply the UV scale before the UV offset.
.metalnessnumber The metalness parameter of the material. This is typically 0 or 1. By default, shaders multiply this property with the value from the metalness texture (when present) to get the final metalness used for shading.
.roughnessnumber The roughness parameter of the material. By default, shaders multiply this property with the value from the roughness texture (when present) to get the final roughness used for shading.
.clearcoatnumber The clearcoat parameter of the material.
.clearcoatRoughnessnumber The roughness of the clearcoat layer.
.occlusionStrengthnumber A number multiplied by the value from the ambient occlusion texture to control how strong the occlusion effect is.
.normalScalenumber A number multiplied by the value from the normal texture to control how strong the normal mapping effect is.
.alphaCutoffnumber If a pixel has an alpha value less than the alpha cutoff, it will be discarded, which prevents it from occluding things behind it. This is sometimes called "holepunch" or "cutout" alpha. It's useful for textures with transparency.
.texturenumber The index of the Image used for the color texture.
.glowTexturenumber The index of the Image used for the glow texture.
.occlusionTexturenumber The index of the Image used for the ambient occlusion texture. The red channel of the texture is used for ambient occlusion, allowing multiple parameters to use the same texture.
.metalnessTexturenumber The index of the Image used for the metalness texture. The blue channel of the texture is used for metalness, allowing multiple parameters to use the same texture.
.roughnessTexturenumber The index of the Image to use for the roughness texture. The green channel of the texture is used for roughness, allowing multiple parameters to use the same texture.
.clearcoatTexturenumber The index of the Image to use for the clearcoat texture. The red channel of the texture is used for the clearcoat parameter, allowing multiple parameters to use the same texture.
.normalTexturenumber The index of the Image to use for the normal map.

properties = ModelData:getMaterial(name)

Arguments

NameTypeDescription
namestring The name of a material.

Returns

NameTypeDescription
propertiestable The material properties.
.colortable The color of the material. The table contains the r, g, b, and a components of the color, from 0 to 1.
.glowtable The glow color of the material (sometimes called emissive). The table contains the r, g, and b components of the color from 0 to 1, and a fourth number indicating the strength of the glow.
.uvShifttable A table with 2 numbers indicating an offset to apply to UVs.
.uvScaletable A table with 2 numbers indicating a scale to apply to UVs. By default, shaders apply the UV scale before the UV offset.
.metalnessnumber The metalness parameter of the material. This is typically 0 or 1. By default, shaders multiply this property with the value from the metalness texture (when present) to get the final metalness used for shading.
.roughnessnumber The roughness parameter of the material. By default, shaders multiply this property with the value from the roughness texture (when present) to get the final roughness used for shading.
.clearcoatnumber The clearcoat parameter of the material.
.clearcoatRoughnessnumber The roughness of the clearcoat layer.
.occlusionStrengthnumber A number multiplied by the value from the ambient occlusion texture to control how strong the occlusion effect is.
.normalScalenumber A number multiplied by the value from the normal texture to control how strong the normal mapping effect is.
.alphaCutoffnumber If a pixel has an alpha value less than the alpha cutoff, it will be discarded, which prevents it from occluding things behind it. This is sometimes called "holepunch" or "cutout" alpha. It's useful for textures with transparency.
.texturenumber The index of the Image used for the color texture.
.glowTexturenumber The index of the Image used for the glow texture.
.occlusionTexturenumber The index of the Image used for the ambient occlusion texture. The red channel of the texture is used for ambient occlusion, allowing multiple parameters to use the same texture.
.metalnessTexturenumber The index of the Image used for the metalness texture. The blue channel of the texture is used for metalness, allowing multiple parameters to use the same texture.
.roughnessTexturenumber The index of the Image to use for the roughness texture. The green channel of the texture is used for roughness, allowing multiple parameters to use the same texture.
.clearcoatTexturenumber The index of the Image to use for the clearcoat texture. The red channel of the texture is used for the clearcoat parameter, allowing multiple parameters to use the same texture.
.normalTexturenumber The index of the Image to use for the normal map.

Notes

All images are optional and may be nil.

See also