logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class MaterialDelta

    Represents a collection of material property changes for procedural animation. Analogous to PoseDelta but for material properties instead of bone transforms.

    Combination Semantics: Uses last-write-wins per MaterialId. When combining two MaterialDeltas, entries from the other delta overwrite existing entries with the same MaterialId. This is deterministic given consistent ordering.

    Weight Semantics: Weight represents blend strength, not additive contribution. A weight of 0 means "no change" (original color preserved), and 1 means "full delta applied". The applier is responsible for lerping between original and delta colors based on weight.

    Why Separate from PoseDelta: Material changes target renderers (visual appearance) while pose changes target transforms (skeletal animation). They have different application semantics, different Unity APIs (MaterialPropertyBlock vs Transform), and may be applied to different objects (a character's body vs. equipment materials).

    Inheritance
    object
    MaterialDelta
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.ProceduralExpression.Domain.Entities
    Assembly: Serenity.ProceduralExpression.Domain.dll
    Syntax
    public class MaterialDelta

    Constructors

    MaterialDelta()

    Creates an empty MaterialDelta with no entries.

    Declaration
    public MaterialDelta()

    Properties

    Count

    Gets the number of entries in this delta.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    IsEmpty

    Checks if this delta has any entries.

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    bool

    Methods

    Clear()

    Clears all material property entries.

    Declaration
    public void Clear()

    Clone()

    Creates a deep copy of this MaterialDelta.

    Declaration
    public MaterialDelta Clone()
    Returns
    Type Description
    MaterialDelta

    A new MaterialDelta with the same entries.

    Combine(MaterialDelta)

    Combines another MaterialDelta into this one using last-write-wins semantics. Entries from the other delta overwrite existing entries with the same MaterialId.

    Declaration
    public void Combine(MaterialDelta other)
    Parameters
    Type Name Description
    MaterialDelta other

    The MaterialDelta to merge into this one.

    GetEntries()

    Gets all material property entries for applier access.

    Declaration
    public IReadOnlyDictionary<MaterialId, MaterialPropertyData> GetEntries()
    Returns
    Type Description
    IReadOnlyDictionary<MaterialId, MaterialPropertyData>

    Read-only dictionary of MaterialId to MaterialPropertyData.

    Scale(float)

    Scales all internal weights by the given factor. Used for layer blending where the layer itself has a weight.

    Declaration
    public void Scale(float weight)
    Parameters
    Type Name Description
    float weight

    The weight multiplier (0-1).

    SetColor(MaterialId, ColorRGBA, float)

    Sets the color for a material target with the specified blend weight. If an entry already exists for this MaterialId, it is overwritten.

    Declaration
    public void SetColor(MaterialId id, ColorRGBA color, float weight = 1)
    Parameters
    Type Name Description
    MaterialId id

    The material target identifier.

    ColorRGBA color

    The target color to apply.

    float weight

    Blend weight (0-1). Default is 1 (full application).

    In this article
    © 2026 Serenity. All Rights Reserved