Skip to content

struct

PhysicalMaterial

pub struct PhysicalMaterial {
    pub metallic: f32,
    pub roughness: f32,
    pub emissive: Color,
    pub emissive_intensity: f32,
    pub opacity: f32,
    pub env_intensity: f32,
    pub map: Option<TextureRef>,
    pub roughness_map: Option<TextureRef>,
    pub metallic_map: Option<TextureRef>,
    pub normal_map: Option<TextureRef>,
    pub normal_scale: f32,
    pub occlusion_map: Option<TextureRef>,
    pub occlusion_strength: f32,
    pub emissive_map: Option<TextureRef>,
}

The physically based material: Cook-Torrance (GGX) shading with a metallic-roughness workflow. The base colour (albedo) is the object's colour, times map.

Fields

metallic

pub metallic: f32

0 (dielectric) to 1 (metal).

roughness

pub roughness: f32

0 (mirror) to 1 (fully rough).

emissive

pub emissive: Color

Emitted colour (black: none), times emissive_intensity.

emissive_intensity

pub emissive_intensity: f32

How strongly it emits emissive.

opacity

pub opacity: f32

0 (invisible) to 1 (opaque).

env_intensity

pub env_intensity: f32

How strongly it reflects the sky and ground ambient.

map

pub map: Option<TextureRef>

Base-colour (albedo) texture, multiplied with the colour.

roughness_map

pub roughness_map: Option<TextureRef>

Roughness from the green channel (glTF's layout), times roughness.

metallic_map

pub metallic_map: Option<TextureRef>

Metalness from the blue channel, times metallic.

normal_map

pub normal_map: Option<TextureRef>

Tangent-space normals (tangents come from the uvs).

normal_scale

pub normal_scale: f32

How strongly normal_map bends the normals.

occlusion_map

pub occlusion_map: Option<TextureRef>

Ambient occlusion from the red channel.

occlusion_strength

pub occlusion_strength: f32

How strongly occlusion_map darkens.

emissive_map

pub emissive_map: Option<TextureRef>

Emitted colour, times emissive.

Methods

textures

pub fn textures(&self) -> Vec<&TextureRef>

The textures it samples.

Trait implementations