GenesisLighting
GenesisLighting groups the toon and stylized lighting controls of a Genesis material — cel banding, Fresnel rim, specular models, MatCap, and Gooch warm/cool shading. You never construct it directly; reach it through GenesisMaterial.Lighting.
using Genesis.Runtime;
var gm = new GenesisMaterial(GetComponent<Renderer>());
gm.Lighting.SetCelMode(GenesisCelMode.Stepped);
gm.Lighting.SetCelSteps(4);
gm.Lighting.EnableRim(Color.cyan, 1.5f);
gm.Apply();Setters here buffer into the same MaterialPropertyBlock as the owning GenesisMaterial. Mutate as many properties as you like, then call gm.Apply() once per frame to commit them.
Properties
Methods
Examples
Build a full toon lighting stack
using Genesis.Runtime;
using UnityEngine;
public class ToonSetup : MonoBehaviour
{
[SerializeField] Renderer target;
GenesisMaterial gm;
void Start()
{
gm = new GenesisMaterial(target);
gm.Lighting.SetCelMode(GenesisCelMode.Stepped);
gm.Lighting.SetCelSteps(3);
gm.Lighting.ShadowColor = new Color(0.18f, 0.20f, 0.28f);
gm.Lighting.EnableRim(Color.white, 1.2f);
gm.Lighting.SetSpecularModel(GenesisSpecularModel.Stylized);
gm.Apply();
}
void OnDestroy() => gm.Dispose();
}SetCelMode, EnableRim, and SetMatCap toggle shader keywords, which can stall the first time an uncompiled variant renders. Prewarm the variants you switch into at runtime — see Runtime Keywords.
See also
Last updated on