SpriteMaterial class Materials

A material for camera-facing quads drawn by BillboardGeometry.

Samples colorTexture at the billboard's (flipbook-aware) UV, multiplies by the per-instance color and tint, and outputs linear HDR premultiplied alpha. blendMode chooses alpha vs additive compositing; both run in the renderer's one translucent pass.

Sprites are always treated as translucent (so they are depth-sorted against the scene and skip the shadow and depth passes) and are drawn double-sided, since a camera-facing quad's winding is not meaningful.

Wraps the SpriteFragment shader from baseShaderLibrary.

Inheritance

Constructors

SpriteMaterial({TextureSource? colorTexture})
Creates a SpriteMaterial, optionally textured.

Properties

blendMode SpriteBlendMode
How sprites of this material composite into the scene.
getter/setter pair
cameraNearFade double
Camera fade distance in world units, 0 (the default) off. Sprites dissolve as the camera gets within this distance, so it never clips through a hard-edged quad.
getter/setter pair
colorTexture TextureSource?
The sprite's color texture, sampled and multiplied by the per-instance color and tint. Accepts a Texture2D or a RenderTexture; an empty slot resolves to a 1x1 white placeholder.
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
fragmentShader Shader
The fragment shader used when rendering geometry with this material.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
name String
The name of this material, used for identification.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sampler SamplerOptions
The sampler used for colorTexture. Defaults to linear filtering with edge clamping, which suits both single sprites and flipbook atlases.
getter/setter pair
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 a snapshot of the scene color taken after the opaque phase (splitting the scene pass in two). 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
softDepthFade double
Soft-particle fade distance in world units, 0 (the default) off.
getter/setter pair
tint ↔ Vector4
Linear RGBA tint multiplied into every sprite of this material.
getter/setter pair

Methods

bind(RenderPass pass, TransientWriter 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
setFragmentShaderName(String name) → void
Assigns the fragment shader by name from baseShaderLibrary.
inherited
toString() String
A string representation of this object.
inherited

Operators

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