Class DitherMatrixBiasProperties
- Namespace
- Gamelogic.Fx.Dithering.PostProcessing.Effects
- Assembly
- Gamelogic.Fx.Dithering.dll
Shader properties for the dither matrix bias post-processing effect.
[Serializable]
public class DitherMatrixBiasProperties : ShaderProperties
- Inheritance
-
DitherMatrixBiasProperties
- Inherited Members
Properties
DitherAmountMax
Gets or sets the maximum dither bias, in the range [-1, 1].
public float DitherAmountMax { get; set; }
Property Value
DitherAmountMin
Gets or sets the minimum dither bias, in the range [-1, 1].
public float DitherAmountMin { get; set; }
Property Value
LevelCount
Gets or sets the number of quantization levels per color channel.
public int3 LevelCount { get; set; }
Property Value
- int3
MatrixB
Gets or sets the dither matrix for the blue channel.
public FloatMatrix MatrixB { get; set; }
Property Value
MatrixG
Gets or sets the dither matrix for the green channel.
public FloatMatrix MatrixG { get; set; }
Property Value
MatrixR
Gets or sets the dither matrix for the red channel.
public FloatMatrix MatrixR { get; set; }
Property Value
PixelOffset
Gets or sets the pixel offset of the dither pattern.
public Vector2 PixelOffset { get; set; }
Property Value
PixelSize
Gets or sets the size of the dither pattern in pixels.
public Vector2 PixelSize { get; set; }
Property Value
Pixelate
Gets or sets whether the output is snapped to the dither grid.
public bool Pixelate { get; set; }
Property Value
ShaderName
Gets the name of the shader used by this property set.
public override string ShaderName { get; }
Property Value
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
ToolMode
Gets or sets the debug visualization mode applied to the effect material.
public ToolMode ToolMode { get; set; }
Property Value
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
effectMaterialMaterial
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().