PhysicallyBasedMaterial class Materials

A metallic-roughness physically based material with optional layered and transmissive features.

The material selects and caches an internal shader variant from its active features. Basic opaque configurations use the standard shader, while clearcoat, sheen, transmission, anisotropy, iridescence, and related properties activate physical variants without changing the public type. Importers normalize format-specific extensions into these scene-native properties.

Translucency is determined by transmission, alphaMode, and baseColorFactor's alpha component.

Inheritance

Constructors

PhysicallyBasedMaterial({TextureSource? baseColorTexture, TextureSource? metallicRoughnessTexture, TextureSource? normalTexture, TextureSource? emissiveTexture, TextureSource? 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
anisotropy double
Anisotropic reflection strength.
getter/setter pair
anisotropyRotation double
Anisotropy direction rotation in radians.
getter/setter pair
anisotropyTexture TextureSource?
Anisotropy direction and strength texture.
getter/setter pair
anisotropyTextureTexCoord int
Texture-coordinate channel used by anisotropyTexture.
getter/setter pair
anisotropyTextureTransform TextureTransform
UV transform applied to anisotropyTexture.
getter/setter pair
attenuationColor ↔ Vector4
Linear volume attenuation color.
getter/setter pair
attenuationDistance double
Distance at which volume attenuation reaches attenuationColor.
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 TextureSource?
The albedo (base color) texture, sampled in linear space and multiplied by baseColorFactor. Defaults to white when null.
getter/setter pair
baseColorTextureTexCoord int
Texture-coordinate channel used by baseColorTexture.
getter/setter pair
baseColorTextureTransform TextureTransform
UV transform applied to baseColorTexture.
getter/setter pair
clearcoat double
Clearcoat layer weight.
getter/setter pair
clearcoatNormalScale ↔ Vector2
Clearcoat normal-map strength on each tangent axis.
getter/setter pair
clearcoatNormalTexture TextureSource?
Clearcoat tangent-space normal texture.
getter/setter pair
clearcoatNormalTextureTexCoord int
Texture-coordinate channel used by clearcoatNormalTexture.
getter/setter pair
clearcoatNormalTextureTransform TextureTransform
UV transform applied to clearcoatNormalTexture.
getter/setter pair
clearcoatRoughness double
Clearcoat perceptual roughness.
getter/setter pair
clearcoatRoughnessTexture TextureSource?
Clearcoat roughness texture.
getter/setter pair
clearcoatRoughnessTextureTexCoord int
Texture-coordinate channel used by clearcoatRoughnessTexture.
getter/setter pair
clearcoatRoughnessTextureTransform TextureTransform
UV transform applied to clearcoatRoughnessTexture.
getter/setter pair
clearcoatTexture TextureSource?
Clearcoat weight texture.
getter/setter pair
clearcoatTextureTexCoord int
Texture-coordinate channel used by clearcoatTexture.
getter/setter pair
clearcoatTextureTransform TextureTransform
UV transform applied to clearcoatTexture.
getter/setter pair
depthAlphaMasked bool
Whether the depth-writing passes (the shadow map and the camera depth prepass) must alpha-test this material's coverage instead of writing its full geometry, so cutout surfaces (foliage, fences) occlude, shadow, and receive screen-space effects only where they are actually opaque. When true, those passes draw with a masked fragment shader (which needs the full-vertex varyings, so the position-only depth path is skipped) and call bindDepthAlphaMask. The base material writes full geometry.
no setter
depthBias double
World-space offset toward the camera used for coplanar surface details. Positive values keep an overlay in front of its supporting surface without modifying its node transform. Zero and negative values leave the draw position unchanged. A fixed world offset provides fewer depth-buffer units as camera distance grows, so distant coplanar surfaces may need a larger value.
getter/setter pairinherited
diffuseTransmission double
Diffuse transmission weight.
getter/setter pair
diffuseTransmissionColor ↔ Vector4
Linear diffuse transmission color.
getter/setter pair
diffuseTransmissionColorTexture TextureSource?
Diffuse transmission color texture.
getter/setter pair
diffuseTransmissionColorTextureTexCoord int
Texture-coordinate channel used by diffuseTransmissionColorTexture.
getter/setter pair
diffuseTransmissionColorTextureTransform TextureTransform
UV transform applied to diffuseTransmissionColorTexture.
getter/setter pair
diffuseTransmissionTexture TextureSource?
Diffuse transmission weight texture.
getter/setter pair
diffuseTransmissionTextureTexCoord int
Texture-coordinate channel used by diffuseTransmissionTexture.
getter/setter pair
diffuseTransmissionTextureTransform TextureTransform
UV transform applied to diffuseTransmissionTexture.
getter/setter pair
dispersion double
Chromatic transmission spread.
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
emissiveStrength double
Multiplier for emissive radiance. Values above 1 produce HDR emission.
getter/setter pair
emissiveTexture TextureSource?
Optional emissive texture. Defaults to white when null and is gated by emissiveFactor.
getter/setter pair
emissiveTextureTexCoord int
Texture-coordinate channel used by emissiveTexture.
getter/setter pair
emissiveTextureTransform TextureTransform
UV transform applied to emissiveTexture.
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 setteroverride
hashCode int
The hash code for this object.
no setterinherited
ior double
Index of refraction.
getter/setter pair
iridescence double
Iridescence layer weight.
getter/setter pair
iridescenceIor double
Iridescent film index of refraction.
getter/setter pair
iridescenceTexture TextureSource?
Iridescence weight texture.
getter/setter pair
iridescenceTextureTexCoord int
Texture-coordinate channel used by iridescenceTexture.
getter/setter pair
iridescenceTextureTransform TextureTransform
UV transform applied to iridescenceTexture.
getter/setter pair
iridescenceThicknessMaximum double
Maximum iridescent film thickness in nanometres.
getter/setter pair
iridescenceThicknessMinimum double
Minimum iridescent film thickness in nanometres.
getter/setter pair
iridescenceThicknessTexture TextureSource?
Iridescent film-thickness texture.
getter/setter pair
iridescenceThicknessTextureTexCoord int
Texture-coordinate channel used by iridescenceThicknessTexture.
getter/setter pair
iridescenceThicknessTextureTransform TextureTransform
UV transform applied to iridescenceThicknessTexture.
getter/setter pair
metallicFactor double
Scalar multiplier applied to the metallic channel. 0 is fully dielectric, 1 is fully metallic.
getter/setter pair
metallicRoughnessTexture TextureSource?
The combined metallic-roughness texture (B = metallic, G = roughness). Defaults to white when null.
getter/setter pair
metallicRoughnessTextureTexCoord int
Texture-coordinate channel used by metallicRoughnessTexture.
getter/setter pair
metallicRoughnessTextureTransform TextureTransform
UV transform applied to metallicRoughnessTexture.
getter/setter pair
name String
The name of this material, used for identification.
getter/setter pairinherited
normalScale double
Strength of normalTexture's perturbation. 1 is the unmodified map.
getter/setter pair
normalTexture TextureSource?
Tangent-space normal map. Defaults to a flat normal when null.
getter/setter pair
normalTextureTexCoord int
Texture-coordinate channel used by normalTexture.
getter/setter pair
normalTextureTransform TextureTransform
UV transform applied to normalTexture.
getter/setter pair
occlusionStrength double
Strength of occlusionTexture's effect. 0 ignores the map; 1 applies it fully.
getter/setter pair
occlusionTexture TextureSource?
Optional ambient-occlusion texture (R channel). Defaults to white when null.
getter/setter pair
occlusionTextureTexCoord int
Texture-coordinate channel used by occlusionTexture.
getter/setter pair
occlusionTextureTransform TextureTransform
UV transform applied to occlusionTexture.
getter/setter pair
reflectionRoughnessFactor double
The roughness multiplier applied to reflectionRoughnessTexture in the depth prepass (the material's roughness factor).
no setter
reflectionRoughnessTexture Texture?
The metallic-roughness texture the camera depth prepass samples so screen-space reflections have a per-pixel roughness (roughness in G), or null to use a fully-rough placeholder. The base material has none, so it reads as fully rough and receives no screen-space reflection; a lit material overrides this.
no setter
reflectionRoughnessTextureSampler SamplerOptions?
The sampler used by reflectionRoughnessTexture in the depth prepass.
no setter
reflectionRoughnessTextureTexCoord int
The UV channel sampled by reflectionRoughnessTexture in the depth prepass.
no setter
reflectionRoughnessTextureTransform TextureTransform
The UV transform applied to reflectionRoughnessTexture in the depth prepass.
no setter
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
sceneColorSampleBoundsExpansion double
Maximum local-space distance sampled beyond the current surface.
no setter
sceneColorSampleFilterLodFraction double
Fraction of the scene-color filter pyramid sampled by this material.
no setter
sceneInputs Set<RenderInput>
Per-frame engine inputs this material samples, produced only when a visible material asks for them: RenderInput.depth binds the linear scene depth of the opaque geometry (forcing the depth prepass), and RenderInput.opaqueSceneColor binds the accumulated scene color behind the current draw, and RenderInput.filteredSceneColor adds its roughness-filtered atlas. Together they enable refraction, depth-fade absorption, shoreline foam, and soft-particle style effects on translucent surfaces. The base material requests nothing; a .fmat material declares these with engine_inputs:.
no setteroverride
sheenColor ↔ Vector4
Linear sheen color.
getter/setter pair
sheenColorTexture TextureSource?
Sheen color texture.
getter/setter pair
sheenColorTextureTexCoord int
Texture-coordinate channel used by sheenColorTexture.
getter/setter pair
sheenColorTextureTransform TextureTransform
UV transform applied to sheenColorTexture.
getter/setter pair
sheenRoughness double
Sheen perceptual roughness.
getter/setter pair
sheenRoughnessTexture TextureSource?
Sheen roughness texture.
getter/setter pair
sheenRoughnessTextureTexCoord int
Texture-coordinate channel used by sheenRoughnessTexture.
getter/setter pair
sheenRoughnessTextureTransform TextureTransform
UV transform applied to sheenRoughnessTexture.
getter/setter pair
specular double
Dielectric specular weight.
getter/setter pair
specularAntiAliasingThreshold double
Upper bound on the extra roughness specularAntiAliasingVariance may add, in the squared-roughness domain. Caps the effect so strongly varying normals cannot over-roughen a surface. Default 0.2.
getter/setter pair
specularAntiAliasingVariance double
Strength of geometric specular antialiasing.
getter/setter pair
specularColor ↔ Vector4
Linear dielectric specular color.
getter/setter pair
specularColorTexture TextureSource?
Dielectric specular color texture.
getter/setter pair
specularColorTextureTexCoord int
Texture-coordinate channel used by specularColorTexture.
getter/setter pair
specularColorTextureTransform TextureTransform
UV transform applied to specularColorTexture.
getter/setter pair
specularTexture TextureSource?
Dielectric specular weight texture.
getter/setter pair
specularTextureTexCoord int
Texture-coordinate channel used by specularTexture.
getter/setter pair
specularTextureTransform TextureTransform
UV transform applied to specularTexture.
getter/setter pair
thickness double
Volume thickness in scene units.
getter/setter pair
thicknessTexture TextureSource?
Volume thickness texture.
getter/setter pair
thicknessTextureTexCoord int
Texture-coordinate channel used by thicknessTexture.
getter/setter pair
thicknessTextureTransform TextureTransform
UV transform applied to thicknessTexture.
getter/setter pair
translucentDepthWrite bool
Whether this translucent material writes the nearest fragment depth.
no setter
transmission double
Specular transmission weight.
getter/setter pair
transmissionTexture TextureSource?
Specular transmission texture.
getter/setter pair
transmissionTextureTexCoord int
Texture-coordinate channel used by transmissionTexture.
getter/setter pair
transmissionTextureTransform TextureTransform
UV transform applied to transmissionTexture.
getter/setter pair
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, TransientWriter transientsBuffer, Lighting lighting) → void
Binds this material's render-pass state, uniforms, and textures.
override
bindDepthAlphaMask(RenderPass pass, Shader shader, TransientWriter transientsBuffer) → void
Binds the mask texture and MaskInfo parameters consumed by the masked depth fragment shaders; shader is the masked variant the pass drew with. Called only when depthAlphaMasked is true.
fragmentShaderForLighting(Lighting lighting) Shader
Selects this material's fragment shader for the frame lighting state.
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
setFragmentShaderName(String name, {String? cubeName}) → void
Assigns the fragment shader by name from baseShaderLibrary.
inherited
setRadianceCubeFragmentShader(Shader? shader) → void
Assigns the already-loaded variant built with FLUTTER_SCENE_RADIANCE_CUBE, the counterpart of setFragmentShader for a material that samples the environment.
inherited
toString() String
A string representation of this object.
inherited

Operators

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