Skip to main content

UnityPbrMetallicRoughness

Struct UnityPbrMetallicRoughness 

Source
pub struct UnityPbrMetallicRoughness {
Show 15 fields pub name: String, pub base_color_texture: Option<u32>, pub metallic_roughness_texture: Option<u32>, pub normal_texture: Option<u32>, pub occlusion_texture: Option<u32>, pub emissive_texture: Option<u32>, pub base_color_factor: [f32; 4], pub metallic_factor: f32, pub roughness_factor: f32, pub normal_scale: f32, pub occlusion_strength: f32, pub emissive_factor: [f32; 3], pub alpha_cutoff: f32, pub alpha_mode: u32, pub double_sided: bool,
}
Expand description

A glTF 2.0 PBR metallic-roughness material in Unity-ready form.

All texture slots hold an image index (into the parent document’s image map), already resolved through the glTF texture → image indirection.

Scalar values are stored in glTF convention and must be mapped to the target shader’s property names by the importer (BiRP and URP use different names).

Fields§

§name: String

The material name. Falls back to the material index as a string if unnamed.

§base_color_texture: Option<u32>

Base color (albedo) texture image index.

§metallic_roughness_texture: Option<u32>

Metallic-roughness texture image index. glTF packing: G channel = roughness, B channel = metallic.

§normal_texture: Option<u32>

Tangent-space normal map image index.

§occlusion_texture: Option<u32>

Ambient occlusion texture image index. Stored in the R channel.

§emissive_texture: Option<u32>

Emissive texture image index.

§base_color_factor: [f32; 4]

RGBA base color factor. Default [1, 1, 1, 1].

§metallic_factor: f32

Metallic factor in [0, 1]. Default 1.

§roughness_factor: f32

Perceptual roughness factor in [0, 1]. Default 1. This is glTF roughness, not Unity smoothness — importer must invert for shaders that expect smoothness (smoothness = 1 - roughness_factor).

§normal_scale: f32

Normal map scale multiplier. Default 1.

§occlusion_strength: f32

Occlusion strength in [0, 1]. Default 1.

§emissive_factor: [f32; 3]

RGB emissive factor. Default [0, 0, 0].

§alpha_cutoff: f32

Alpha cutoff threshold for ALPHA_MODE_MASK. Default 0.5.

§alpha_mode: u32

Alpha rendering mode: 0 = ALPHA_MODE_OPAQUE, 1 = ALPHA_MODE_MASK, 2 = ALPHA_MODE_BLEND.

§double_sided: bool

falseCullMode.Back (2, single-sided); trueCullMode.Off (0, double-sided).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.