Material

class Material(nativeHandle: NativePointer)

Material defines the visual appearance of a surface.

Materials are created from a binary blob generated by the material compiler (matc). A Material is a template from which MaterialInstance objects can be created.

Creating instances: Use createInstance() to spawn an instance from this material. Instances inherit the material's properties but can override parameters (color, texture, etc.) for per-object customization. Always destroy instances with Engine.destroy() before destroying the material.

Material compilation: Use compile() to asynchronously compile specific material variants. This is useful for precompiling variants you know will be used, reducing first-time rendering stalls. After issuing multiple compile() calls, call Engine.flush() so the backend can start compilation work.

Material properties: Material properties are read-only and determined at compile time from the matc-generated blob. These include shading model, blending mode, transparency mode, and other rendering settings. To override parameters per-instance, use MaterialInstance.

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer)

Types

Link copied to clipboard

Blending mode determines how a material's color is combined with the background.

Link copied to clipboard
class Builder

Builder for creating Material objects from compiled material packages.

Link copied to clipboard

Priority queue for asynchronous material compilation.

Link copied to clipboard

Culling mode determines which faces are rendered.

Link copied to clipboard

Attribute interpolation type in the fragment shader.

Link copied to clipboard

Holds information about a material parameter.

Link copied to clipboard

Uniform parameter types.

Link copied to clipboard

Precision of a numeric parameter.

Link copied to clipboard

Texture type of a sampler parameter.

Link copied to clipboard

Shading model determines how light interacts with the material surface.

Link copied to clipboard

Type of a subpass input parameter.

Link copied to clipboard

How transparent objects are rendered.

Link copied to clipboard

UBO batching mode controls whether material instances share uniform buffers.

Link copied to clipboard

Vertex domain specifies which coordinate space vertices are defined in.

Properties

Link copied to clipboard

The blending mode.

Link copied to clipboard

The face culling mode.

Link copied to clipboard

Get this material's default instance.

Link copied to clipboard

The minimum required feature level for this material.

Link copied to clipboard

Whether this material uses the shadowing factor as a color multiplier (unlit materials only).

Link copied to clipboard

Whether this material has specular anti-aliasing enabled.

Link copied to clipboard

The vertex attribute interpolation mode.

Link copied to clipboard

Whether alpha-to-coverage is enabled.

Link copied to clipboard

Whether color writes are enabled.

Link copied to clipboard

Whether depth testing is enabled.

Link copied to clipboard

Whether depth writes are enabled.

Link copied to clipboard

Whether this material renders both front and back faces (double-sided).

Link copied to clipboard

The alpha threshold for MASKED blending mode, in 0, 1.

Link copied to clipboard

The domain the material's shaders apply to.

Link copied to clipboard

The name of this material, from the matc-compiled blob.

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Link copied to clipboard

The number of parameters declared by this material.

Link copied to clipboard

Information about all parameters declared by this material.

Link copied to clipboard

The reflection mode.

Link copied to clipboard

The refraction mode.

Link copied to clipboard

The refraction surface type.

Link copied to clipboard

The vertex attributes required by this material.

Link copied to clipboard

The shading model.

Link copied to clipboard

The material's source, if the material was built with it (matc -g); empty otherwise.

Link copied to clipboard

The clamping threshold of specular anti-aliasing, in 0, 1.

Link copied to clipboard

The screen-space variance of the specular anti-aliasing filter kernel, in 0, 1.

Link copied to clipboard

The variants this material supports: a mask of UserVariantFilterBit values.

Link copied to clipboard

The transparency rendering mode (only relevant for TRANSPARENT/FADE blending).

Link copied to clipboard

The vertex coordinate space domain.

Functions

Link copied to clipboard
fun compile(priority: Material.CompilerPriorityQueue, variants: Int = UserVariantFilterBit.ALL, callback: (Material) -> Unit? = null)

Asynchronously compile a subset of this Material's variants.

Link copied to clipboard

Creates a new instance of this material. Material instances should be freed using Engine.destroy(MaterialInstance).

Link copied to clipboard

Get the transform parameter name associated with a sampler.

Link copied to clipboard

Indicates whether a parameter of the given name exists on this material.

Link copied to clipboard

Indicates whether an existing parameter is a sampler or not.

Link copied to clipboard

Sets a parameter on this material's default instance. @see MaterialInstance.setParameter

fun setDefaultParameter(name: String, texture: Texture?, sampler: TextureSampler)
fun setDefaultParameter(name: String, x: Int, y: Int)
fun setDefaultParameter(name: String, x: Float, y: Float, z: Float)
fun setDefaultParameter(name: String, x: Int, y: Int, z: Int)
fun setDefaultParameter(name: String, type: RgbType, r: Float, g: Float, b: Float)
fun setDefaultParameter(name: String, x: Float, y: Float, z: Float, w: Float)
fun setDefaultParameter(name: String, x: Int, y: Int, z: Int, w: Int)
fun setDefaultParameter(name: String, type: RgbaType, r: Float, g: Float, b: Float, a: Float)