Table of Contents

Class DitherGridBiasProperties

Namespace
Gamelogic.Fx.Dithering.PostProcessing.Effects
Assembly
Gamelogic.Fx.Dithering.dll

Shader properties for the grid bias dither post-processing effect.

[Serializable]
public class DitherGridBiasProperties : ShaderProperties
Inheritance
DitherGridBiasProperties
Inherited Members

Constructors

DitherGridBiasProperties()

Initializes a new instance with Uniform 3 as the default fundamental region for all channels.

public DitherGridBiasProperties()

Remarks

Unity bypasses this constructor when deserializing, so existing serialized components are unaffected; only new instances (added at runtime or in the editor) receive these defaults.

Properties

DitherAmountMax

Gets or sets the maximum dither bias, in the range [-1, 1].

public float DitherAmountMax { get; set; }

Property Value

float

DitherAmountMin

Gets or sets the minimum dither bias, in the range [-1, 1].

public float DitherAmountMin { get; set; }

Property Value

float

FundamentalRegionRGB

Gets the dither fundamental region for all three color channels.

public FundamentalRegionRGB FundamentalRegionRGB { get; }

Property Value

FundamentalRegionRGB

GridAngle

Gets or sets the rotation of the dither grid in degrees.

public float GridAngle { get; set; }

Property Value

float

GridType

Gets or sets the cell geometry used for the dither grid.

public GridType GridType { get; set; }

Property Value

GridType

LevelCount

Gets or sets the number of quantization levels per color channel.

public int3 LevelCount { get; set; }

Property Value

int3

PixelOffset

Gets or sets the sub-pixel offset used when snapping to the dither grid.

public Vector2 PixelOffset { get; set; }

Property Value

Vector2

PixelSize

Gets or sets the size of the dither pattern in pixels.

public Vector2 PixelSize { get; set; }

Property Value

Vector2

Pixelate

Gets or sets whether the output is snapped to the dither grid.

public bool Pixelate { get; set; }

Property Value

bool

ShaderName

Gets the name of the shader used by this property set.

public override string ShaderName { get; }

Property Value

string

Remarks

This name is passed to the internal shader lookup system when the properties are enabled. It should match the full shader path as defined in the shader file.

Smoothness

Gets or sets the smoothness of the dither transition, in the range [0, 1].

public float Smoothness { get; set; }

Property Value

float

ToolMode

Gets or sets the debug visualization mode applied to the effect material.

public ToolMode ToolMode { get; set; }

Property Value

ToolMode

Methods

CheckMaterialVersion()

Checks whether any condition requires the owning material to be recreated, and calls IncMaterialVersion() if so.

public override void CheckMaterialVersion()

Remarks

The owning post-process calls this method at the top of each render, before fetching the effect material. This guarantees that staleness detection and material recreation happen in the same frame, with no visible lag.

Override this in subclasses whose properties can change size independently of normal inspector validation — for example, float arrays, texture arrays, or compute buffers whose element count is driven by user-editable data. Compare the current state against a stored "last seen" snapshot and call IncMaterialVersion() on a mismatch.

See Gamelogic.Fx.Dithering.PostProcessing.Effects.DitherMatrixBiasProperties for a worked example: it tracks each channel matrix's FloatMatrix.SizeVersion and increments the material version whenever any matrix is resized.

SetMaterialProperties(Material)

Applies all shader-related properties to the given material.

public override void SetMaterialProperties(Material effectMaterial)

Parameters

effectMaterial Material

Remarks

Subclasses should override this method and set all relevant shader uniforms (for example, floats, vectors, colors, textures, and keywords).

Do not call IncMaterialVersion() here. By the time this method is called the material has already been fetched, so any increment would take effect one frame late. Staleness checks belong in CheckMaterialVersion().