Docsv3.31.0
Back to API Reference
Class

ExtrudeModifier

Adds a 3D extrude/bevel effect by appending a stack of progressively offset duplicate quads behind the face, shaded across a near→far colour gradient.

Remarks

Layers are flushed back-to-front in layer-major order across all glyphs (every glyph's deepest slice first, then every glyph's next-deeper slice, …, then face). Naïve per-glyph fanout would invert that order at glyph boundaries when the cumulative offset exceeds glyph advance, leaving farther slices of glyph N+1 covering closer slices of glyph N. Per-layer buffers preserve the painter order regardless of overlap. Parameter: offset ("x y") + [,#nearColor][,#farColor][,dilate][,softness]. Defaults: offset = (0.3, -0.3) in em (scaled by the glyph metric factor; with FixedPixelSize the values are fixed pixels instead), near = white, far = black, dilate = 0, softness = 0.
public Vector2 Offset{ get; set }

Per-step displacement of the extrusion. A per-range value overrides it.

public Color32 NearColor{ get; set }

Colour of the face-adjacent (near) slice. A per-range value overrides it.

public Color32 FarColor{ get; set }

Colour of the deepest (far) slice. A per-range value overrides it.

public float Dilate{ get; set }

SDF dilation applied to each slice. A per-range value overrides it.

public float Softness{ get; set }

Edge softness of each slice. A per-range value overrides it.

public int Steps{ get; set }

Number of extrude layers stacked behind the face (minimum 1). More layers produce a smoother depth gradient and a longer apparent extrusion at the cost of additional duplicate-quad geometry per glyph.

public bool Bevel{ get; set }

When true, layers alternate between the near and far face colours rather than blending across, producing a faceted bevel highlight. The layer count effectively doubles (Steps × 2) because each step contributes a near face and a side face.

public bool FixedPixelSize{ get; set }

When true, the per-range offsetX / offsetY / dilate / softness values are interpreted in fixed pixels and compensated by the glyph metric factor so the extrusion has constant on-screen geometry independent of font size.

public bool RendersBehindFill{ get }
protected override void OnEnable()
protected override void OnDestroy()
protected override void ResetOwnRequests()
protected override void BeforeApply()
protected override void OnApply(in RangeApplyContext context)
protected override void OnGlyphEffect()
protected override void OnFlush()

Layer-major flush: every glyph's deepest slice first, then every glyph's next slice, …, then the face. Each layer maintains its own emit buffer, so painter order survives inter-glyph overlap when the cumulative extrusion offset exceeds glyph advance. All slices record the sequence captured for their glyph; the generator's stable sort then keeps the deepest-first emission order within the layer.

protected override void OnEmitQuad(int sourceBaseIdx, int destBaseIdx, int payload)

Not used — ExtrudeModifier bypasses the base emit-queue indirection and writes all per-layer slots directly inside its OnFlush override.