Skip to Content
DocumentationScripting APIStylization API

GenesisStylization

Namespace: Genesis.Runtime · Assembly: Genesis.Runtime.dll · Inherits: System.Object

GenesisStylization wraps the color-grade and stylization band of a Genesis material — hue rotation, posterize, greyscale, and the per-material brightness/contrast/saturation grade. You do not construct it directly; access it through GenesisMaterial.Stylization.

using Genesis.Runtime; var gm = new GenesisMaterial(GetComponent<Renderer>()); gm.Stylization.SetHueShift(120f); // rotate toward green gm.Stylization.SetPosterize(6, 1f); gm.Apply();

Hue shift drives a great team-color path: bind from a per-instance MaterialPropertyBlock via the owning GenesisMaterial(Renderer) so every variant batches together. Commit with gm.Apply().

Properties

HueShift
property
public float HueShift { get; set; }

Hue rotation in degrees, 0360. Maps to _HueShift. See Hue Shift.

Returns float

GreyscaleAmount
property
public float GreyscaleAmount { get; set; }

Lerp toward luminance, 0 (full color) to 1 (full grey). Maps to _GreyscaleAmount. See Greyscale & Posterize.

Returns float

Brightness
property
public float Brightness { get; set; }

Additive offset applied after lighting, -11. Maps to _Brightness. See Color Adjustments.

Returns float

Saturation
property
public float Saturation { get; set; }

Saturation multiplier — 0 greyscale, 1 neutral, 2 vivid. Maps to _Saturation.

Returns float

TintColor
property
public Color TintColor { get; set; }

Final multiplicative tint applied to the graded color. Maps to _TintColor.

Returns Color

Methods

SetHueShift(float, float)
method
public void SetHueShift(float degrees, float strength = 1f)

Sets the hue rotation and its blend strength against the original hue, enabling the GENESIS_HUE_SHIFT keyword. See Hue Shift.

Parameters

NameTypeDescription
degreesfloatRotation in degrees, 0–360. 0 red, 120 green, 240 blue.
strengthfloatBlend against the original hue, 0–1. Defaults to 1.

Returns void

SetHueAnimateSpeed(float)
method
public void SetHueAnimateSpeed(float speed)

Drives the moving-rainbow effect by adding time to the hue shift. Maps to _HueAnimateSpeed.

Parameters

NameTypeDescription
speedfloatRotation speed, 0–10. 0 leaves the shift static.

Returns void

SetPosterize(int, float)
method
public void SetPosterize(int levels, float amount = 1f)

Quantizes the color into discrete levels per channel and blends the result in. See Greyscale & Posterize.

Parameters

NameTypeDescription
levelsintSteps per channel, clamped 2–16. 2 = hard, 16 = subtle.
amountfloatBlend between continuous and quantized color, 0–1. Defaults to 1.

Returns void

SetGrade(float, float, float)
method
public void SetGrade(float brightness, float contrast, float saturation)

Sets brightness, contrast, and saturation in one call for the post-lighting grade. See Color Adjustments.

Parameters

NameTypeDescription
brightnessfloatAdditive offset, -1–1.
contrastfloatContrast around mid-grey, typically 0.5–2.
saturationfloat0 greyscale, 1 neutral, 2 vivid.

Returns void

SetGamma(float)
method
public void SetGamma(float gamma)

Applies a creative power curve to the graded color. Maps to _Gamma.

Parameters

NameTypeDescription
gammafloatPower curve, 0.1–4. 2.2 darkens midtones, 0.45 lifts them.

Returns void

Examples

Tint a unit by team color

using Genesis.Runtime; using UnityEngine; public class TeamColor : MonoBehaviour { [SerializeField] Renderer target; GenesisMaterial gm; void Awake() => gm = new GenesisMaterial(target); void OnDestroy() => gm.Dispose(); public void SetTeam(float hueDegrees) { gm.Stylization.SetHueShift(hueDegrees); gm.Apply(); } }

Drain color to grey on death

public IEnumerator FadeToGrey(GenesisMaterial gm, float duration = 0.6f) { for (float t = 0f; t < duration; t += Time.deltaTime) { gm.Stylization.GreyscaleAmount = Mathf.Clamp01(t / duration); gm.Apply(); yield return null; } }

The grade evaluates in a fixed order (contrast → saturation → gamma → tint). Leaving a parameter at its neutral value disables that pass — but writing every property each frame still buffers writes, so batch them and Apply() once.

See also

Last updated on