Skip to content

Game.Rendering.MaterialProperty

Assembly: Assembly-CSharp.dll
Namespace: Game.Rendering

Type: enum

Base: System.Enum

Summary:
Enumeration of material / shader property identifiers used by the game's rendering system. Each enum member is decorated with a custom MaterialProperty attribute that specifies the underlying shader property name, the expected managed type (Unity.Mathematics types such as float, float3, float4) and a boolean flag. Modders can use this enum to map engine-level property identifiers to actual shader uniform names when setting material parameters. The final member Count indicates the number of defined properties.


Fields

  • DefaultPVTStack_Transform
    Mapped shader name: "DefaultPVTStack_atlasParams0", type: Unity.Mathematics.float4. Typically used for transform/atlas parameters for default PVT (position/vertex/texture) stacks.

  • ExtendedPVTStack_Transform
    Mapped shader name: "ExtendedPVTStack_atlasParams0", type: Unity.Mathematics.float4. Same purpose as DefaultPVTStack_Transform but for extended PVT stacks.

  • DefaultPVTStack_TextureInfo
    Mapped shader name: "DefaultPVTStack_atlasParams1", type: Unity.Mathematics.float4. Holds texture sampling/atlas information for default PVT stack.

  • ExtendedPVTStack_TextureInfo
    Mapped shader name: "ExtendedPVTStack_atlasParams1", type: Unity.Mathematics.float4. Texture info for extended PVT stacks.

  • AlbedoAffectEmissive
    Mapped shader name: "_AlbedoAffectEmissive", type: System.Single (float). Controls how albedo influences emissive output.

  • Snow
    Mapped shader name: "_Snow", type: System.Single (float). Snow blending/coverage parameter.

  • SingleLightsOffset
    Mapped shader name: "colossal_SingleLightsOffset", type: System.Single (float). Offset used for single light handling in some colossal rendering passes.

  • TextureArea
    Mapped shader name: "colossal_TextureArea", type: Unity.Mathematics.float4. Area/scale information used for colossal-style materials.

  • MeshSize
    Mapped shader name: "colossal_MeshSize", type: Unity.Mathematics.float4. Per-mesh size parameters used by colossal shaders.

  • LodDistanceFactor
    Mapped shader name: "colossal_LodDistanceFactor", type: System.Single (float). LOD distance scaling factor.

  • BaseColor
    Mapped shader name: "_BaseColor", type: Unity.Mathematics.float4. Base color (RGBA) used by material/shader.

  • DilationParams
    Mapped shader name: "colossal_DilationParams", type: Unity.Mathematics.float4. Parameters for dilation/expand effects in colossal rendering.

  • ImpostorFrames
    Mapped shader name: "_ImpostorFrames", type: System.Single (float). Number of frames or frame-related parameter used by impostor rendering.

  • ImpostorSize
    Mapped shader name: "_ImpostorSize", type: System.Single (float). Size parameter for impostor quads.

  • ImpostorOffset
    Mapped shader name: "_ImpostorOffset", type: Unity.Mathematics.float3. Offset vector applied to impostor geometry.

  • TextureScaleFactor
    Mapped shader name: "_TextureScaleFactor", type: System.Single (float). Global texture scale multiplier.

  • SmoothingDistance
    Mapped shader name: "_SmoothingDistance", type: System.Single (float). Distance used to smooth transitions (e.g., blending LODs).

  • WindRangeLvlB
    Mapped shader name: "_WindRangeLvlB", type: System.Single (float). Wind effect range parameter (level B).

  • WindElasticityLvlB
    Mapped shader name: "_WindElasticityLvlB", type: System.Single (float). Wind elasticity parameter (level B).

  • ShapeParameters1
    Mapped shader name: "colossal_ShapeParameters1", type: Unity.Mathematics.float4. Per-shape parameters used by colossal shaders.

  • ShapeParameters2
    Mapped shader name: "colossal_ShapeParameters2", type: Unity.Mathematics.float4. Additional shape parameters for colossal shaders.

  • Count
    Special enum value representing the total count of defined material properties. Useful for sizing arrays or iterating over all defined properties.

Properties

  • This enum type does not declare instance properties. Use the enum values directly.

Constructors

  • Enums do not declare explicit constructors in C#. There is no public constructor to call — values are used directly.

Methods

  • No custom methods are declared on this enum. Standard System.Enum methods (ToString, Parse, GetValues, etc.) are available.

Usage Example

// Example utilities to map MaterialProperty -> shader property name and set values on a UnityEngine.Material.
// Requires the MaterialPropertyAttribute definition accessible at runtime.

using System;
using System.Reflection;
using UnityEngine;
using Unity.Mathematics;

public static class MaterialPropertyUtil
{
    public static string GetShaderPropertyName(MaterialProperty prop)
    {
        var member = typeof(MaterialProperty).GetMember(prop.ToString());
        if (member.Length == 0) return prop.ToString();
        var attr = (Attribute.GetCustomAttribute(member[0], typeof(MaterialPropertyAttribute)) as MaterialPropertyAttribute);
        return attr != null ? attr.Name : prop.ToString();
    }

    public static void SetMaterialProperty(Material mat, MaterialProperty prop, object value)
    {
        var member = typeof(MaterialProperty).GetMember(prop.ToString());
        if (member.Length == 0) return;
        var attr = (Attribute.GetCustomAttribute(member[0], typeof(MaterialPropertyAttribute)) as MaterialPropertyAttribute);
        if (attr == null) return;

        var name = attr.Name;
        var type = attr.Type;

        if (type == typeof(float))
        {
            mat.SetFloat(name, Convert.ToSingle(value));
        }
        else if (type == typeof(Unity.Mathematics.float4))
        {
            var v = (Unity.Mathematics.float4)value;
            mat.SetVector(name, new Vector4(v.x, v.y, v.z, v.w));
        }
        else if (type == typeof(Unity.Mathematics.float3))
        {
            var v = (Unity.Mathematics.float3)value;
            mat.SetVector(name, new Vector4(v.x, v.y, v.z, 0f));
        }
        // Add additional type handling as needed.
    }
}

Notes for modders: - The enum values correspond to internal shader uniform names; using the MaterialPropertyAttribute at runtime (via reflection) is the most reliable way to obtain the exact shader property string. - The boolean flag in the attribute (third parameter) is not documented here — inspect the MaterialPropertyAttribute implementation to understand its meaning (commonly used for array flags or special handling). - Keep in mind conversion between Unity.Mathematics types (float3/float4) and UnityEngine types (Vector3/Vector4) when setting Material properties.