Logo Mibo

Opacity Module

Types

Type Description

InstanceOpacityFilter

Which instances of an instanced command a staging pass keeps. The per-instance tint alpha makes single instances semi-transparent while their neighbors stay opaque, so transparency is decided per instance: an instance is opaque when its tint alpha is 255 (instances past the colors array clamp to white, matching the staging contract). The filter applies at row-staging time — the kept instances' rows are written compacted, and the command's arrays and palette layout stay untouched.

SkinnedInstancedUnitFilter

Which parts (draw units) of a skinned + instanced command a pass keeps: the parts whose resolved material is opaque, the transparent ones, or all. Materials resolve per part (All override or authored part material / PerMesh resolver), so a command with mixed part opacities draws its opaque parts inline (shadows, depth writes) and defers only its transparent parts.

Functions and values

Function or value Description

animatedModelPartOpacityMix (model, matOverride)

Full Usage: animatedModelPartOpacityMix (model, matOverride)

Parameters:
Returns: bool * bool * bool

One walk over the model's parts: (any part transparent, any part opaque, any part invisible) under the override, resolved exactly as the forward pass resolves materials. Transparent is 0 < Opacity < 1, invisible is Opacity <= 0 — the shadow collector must tell them apart: neither casts, but only a command whose every part is opaque may take the merged fast path (an invisible part must not ride a merged group). Whole-model All short-circuits all three.

model : Model
matOverride : MaterialOverride voption
Returns: bool * bool * bool

anyTransparentInstanceColor (colors, count)

Full Usage: anyTransparentInstanceColor (colors, count)

Parameters:
    colors : Color[] voption
    count : int

Returns: bool
Modifiers: inline

Count-aware whole-batch probe: true when any of the first count instances has a tint alpha below 255. The count matters — a colors array longer than the clamped instance count must not classify instances that never draw.

colors : Color[] voption
count : int
Returns: bool

instanceCentroidDistanceSq (cameraPos, transforms, count)

Full Usage: instanceCentroidDistanceSq (cameraPos, transforms, count)

Parameters:
Returns: float32
Modifiers: inline

Sort key for a deferred instanced batch: squared distance from the camera to the average instance translation. The batch sorts as one unit; ordering between its instances stays submission order (the accepted batch-level approximation).

cameraPos : Vector3
transforms : Matrix[]
count : int
Returns: float32

instanceSubsetStats (cameraPos, transforms, colors, count)

Full Usage: instanceSubsetStats (cameraPos, transforms, colors, count)

Parameters:
Returns: int * float32
Modifiers: inline

The per-instance split decision in one scan: how many of the first count instances are transparent (tint alpha below 255), and the squared distance from cameraPos to the transparent instances' centroid — the deferred subset's sort key. Zero transparent instances returns (0, 0); null transforms or colors return (0, 0) (nothing to split).

cameraPos : Vector3
transforms : Matrix[]
colors : Color[] voption
count : int
Returns: int * float32

isOpenGLBackend ()

Full Usage: isOpenGLBackend ()

Parameters:
    () : unit

Returns: bool
Modifiers: inline
True on the OpenGL backend, which has no vertex texture fetch — skinned +
 instanced draws fall back to per-instance skinned draws there (their transparency
 classification is per part/instance, not per batch).
() : unit
Returns: bool

Type something to start searching.