pub struct Material {
    pub alpha_cutoff: Option<AlphaCutoff>,
    pub alpha_mode: Checked<AlphaMode>,
    pub double_sided: bool,
    pub pbr_metallic_roughness: PbrMetallicRoughness,
    pub normal_texture: Option<NormalTexture>,
    pub occlusion_texture: Option<OcclusionTexture>,
    pub emissive_texture: Option<Info>,
    pub emissive_factor: EmissiveFactor,
    pub extensions: Option<Material>,
    pub extras: Extras,
}
Expand description

The material appearance of a primitive.

Fields

alpha_cutoff: Option<AlphaCutoff>

The alpha cutoff value of the material.

alpha_mode: Checked<AlphaMode>

The alpha rendering mode of the material.

The material’s alpha rendering mode enumeration specifying the interpretation of the alpha value of the main factor and texture.

  • In Opaque mode (default) the alpha value is ignored and the rendered output is fully opaque.

  • In Mask mode, the rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value.

  • In Blend mode, the alpha value is used to composite the source and destination areas and the rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator).

double_sided: bool

Specifies whether the material is double-sided.

  • When this value is false, back-face culling is enabled.

  • When this value is true, back-face culling is disabled and double sided lighting is enabled.

The back-face must have its normals reversed before the lighting equation is evaluated.

pbr_metallic_roughness: PbrMetallicRoughness

A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of pbrMetallicRoughness apply.

normal_texture: Option<NormalTexture>

A tangent space normal map. The texture contains RGB components in linear space. Each texel represents the XYZ components of a normal vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z [1/255 to 1]. The normal vectors use OpenGL conventions where +X is right and +Y is up. +Z points toward the viewer.

occlusion_texture: Option<OcclusionTexture>

The occlusion map texture. The occlusion values are sampled from the R channel. Higher values indicate areas that should receive full indirect lighting and lower values indicate no indirect lighting. These values are linear. If other channels are present (GBA), they are ignored for occlusion calculations.

emissive_texture: Option<Info>

The emissive map controls the color and intensity of the light being emitted by the material. This texture contains RGB components in sRGB color space. If a fourth component (A) is present, it is ignored.

emissive_factor: EmissiveFactor

The emissive color of the material.

extensions: Option<Material>

Extension specific data.

extras: Extras

Optional application specific data.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Retrieves a single value at the given index.

Serialize this value into the given Serde serializer. Read more

Validates the invariants required for the library to function safely.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.