rememberTransparentColorMaterialInstance

fun rememberTransparentColorMaterialInstance(color: LinearColor, alpha: Float = 0.5f, metallic: Float = 0.0f, roughness: Float = 0.5f, reflectance: Float = 0.5f, engine: Engine = LocalFilamentEngine.current ?: noFilamentEngine()): MaterialInstance

A LIT PBR MaterialInstance tinted color with alpha transparency — the "make this object semi-transparent" case with no .mat authoring. Alpha is pre-multiplied by the shader and the material renders in two depth passes so convex primitives composite correctly with themselves.

Transparent surfaces usually shouldn't cast opaque shadows — pass castShadows = false on the primitive for glass-like looks.

Sphere(material = rememberTransparentColorMaterialInstance(LinearColor(0.3f, 0.6f, 0.9f), alpha = 0.35f))

Parameters

color

Linear-sRGB base colour.

alpha

Opacity: 0 = fully transparent, 1 = opaque.

metallic

0 = dielectric, 1 = metal.

roughness

0 = mirror, 1 = fully rough.

reflectance

Dielectric Fresnel reflectance (0.5 ≈ the common 4% default).

engine

Engine that owns the material. Defaults to the current composition scope's engine.