PhysicallyBasedMaterial class

A glTF-style metallic-roughness physically based material with image-based lighting.

Wraps the StandardFragment shader and exposes the parameters from the glTF 2.0 PBR metallic-roughness model:

Translucency is determined by baseColorFactor's alpha component; the material is treated as opaque when alpha is exactly 1.

Inheritance

Constructors

PhysicallyBasedMaterial({Texture? baseColorTexture, Texture? metallicRoughnessTexture, Texture? normalTexture, Texture? emissiveTexture, Texture? occlusionTexture, EnvironmentMap? environment})
Creates a PBR material with the given textures.

Properties

alphaCutoff double
Alpha-test threshold used when alphaMode is AlphaMode.mask: fragments whose alpha falls below this are discarded.
getter/setter pair
alphaMode AlphaMode
How the material's alpha is interpreted; see AlphaMode.
getter/setter pair
baseColorFactor ↔ Vector4
Linear RGBA tint multiplied with baseColorTexture. Alpha controls translucency: values below 1 push the material into the depth- sorted translucent pass.
getter/setter pair
baseColorTexture Texture?
The albedo (base color) texture, sampled in linear space and multiplied by baseColorFactor. Defaults to white when null.
getter/setter pair
doubleSided bool
Whether to render both faces of triangles drawn with this material (glTF's material.doubleSided). When true, bind disables back-face culling so the geometry is visible from both sides; otherwise back faces are culled. Defaults to false. The runtime importer sets it from the glTF material.
getter/setter pairinherited
emissiveFactor ↔ Vector4
Linear RGBA emissive tint. Alpha is unused; the default Vector4.zero() disables emission.
getter/setter pair
emissiveTexture Texture?
Optional emissive texture. Defaults to white when null and is gated by emissiveFactor.
getter/setter pair
environment EnvironmentMap?
Per-material image-based-lighting environment, overriding the scene-wide Scene.environment when set.
getter/setter pair
fragmentShader Shader
The fragment shader used when rendering geometry with this material.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
metallicFactor double
Scalar multiplier applied to the metallic channel. 0 is fully dielectric, 1 is fully metallic.
getter/setter pair
metallicRoughnessTexture Texture?
The combined metallic-roughness texture (B = metallic, G = roughness). Defaults to white when null.
getter/setter pair
normalScale double
Strength of normalTexture's perturbation. 1 is the unmodified map.
getter/setter pair
normalTexture Texture?
Tangent-space normal map. Defaults to a flat normal when null.
getter/setter pair
occlusionStrength double
Strength of occlusionTexture's effect. 0 ignores the map; 1 applies it fully.
getter/setter pair
occlusionTexture Texture?
Optional ambient-occlusion texture (R channel). Defaults to white when null.
getter/setter pair
roughnessFactor double
Scalar multiplier applied to the roughness channel. 0 is a perfect mirror, 1 is fully diffuse.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
vertexColorWeight double
How strongly per-vertex colors influence the final albedo. 0 disables vertex color contribution; 1 (the default) fully applies it.
getter/setter pair

Methods

bind(RenderPass pass, HostBuffer transientsBuffer, Lighting lighting) → void
Binds this material's render-pass state, uniforms, and textures.
override
isOpaque() bool
Whether geometry rendered with this material is fully opaque.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setFragmentShader(Shader shader) → void
Assigns the fragment shader used when this material is drawn.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromFlatbuffer(Material fbMaterial, List<Texture> textures) PhysicallyBasedMaterial
Builds a PhysicallyBasedMaterial from a flatbuffer material description, resolving texture indices against textures.
override