Skip to Content
DocumentationScripting APIRuntime Keywords

GenesisKeywords

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

GenesisKeywords is a static utility that maps the type-safe GenesisFeature enum to the shader keyword strings Genesis compiles against, and helps prewarm variants before they first render. You normally toggle features through GenesisMaterial.EnableFeature; reach for this class directly only for prewarming or low-level keyword work.

using Genesis.Runtime; // Prefer the typed path on a material: gm.EnableFeature(GenesisFeature.Dissolve); // Use GenesisKeywords for prewarming and keyword lookups: string kw = GenesisKeywords.GetKeyword(GenesisFeature.Hologram); // "GENESIS_HOLOGRAM" GenesisKeywords.Prewarm(GenesisFeature.Hologram);

Every feature is gated by a multi-compile keyword, and each on/off combination is a separate compiled variant. Toggling a keyword that has never rendered triggers on-demand compilation — visible as a stall. Prewarm the variants you switch into at runtime.

GenesisFeature enum

GenesisFeature.CelShading
enum
GenesisFeature.CelShading

Cel banding of diffuse lighting. Keyword GENESIS_CEL_SHADING. See Cel Shading.

Returns GenesisFeature

GenesisFeature.RimLighting
enum
GenesisFeature.RimLighting

Fresnel rim highlight along the silhouette. Keyword GENESIS_RIM. See Rim Lighting.

Returns GenesisFeature

GenesisFeature.MatCap
enum
GenesisFeature.MatCap

Material-capture sphere shading. Keyword GENESIS_MATCAP. See MatCap.

Returns GenesisFeature

GenesisFeature.Gooch
enum
GenesisFeature.Gooch

Warm/cool illustrative shading. Keyword GENESIS_GOOCH. See Gooch Shading.

Returns GenesisFeature

GenesisFeature.NormalMap
enum
GenesisFeature.NormalMap

Tangent-space normal mapping. Keyword GENESIS_NORMAL_MAP. See Normal Mapping.

Returns GenesisFeature

GenesisFeature.DetailTextures
enum
GenesisFeature.DetailTextures

Secondary detail albedo + normal layer. Keyword GENESIS_DETAIL_TEXTURES. See Detail Textures.

Returns GenesisFeature

GenesisFeature.LayerTextures
enum
GenesisFeature.LayerTextures

Up to three additive texture layers. Keyword GENESIS_LAYER_TEXTURES. See Layer Textures.

Returns GenesisFeature

GenesisFeature.Dissolve
enum
GenesisFeature.Dissolve

Noise-driven clip dissolve with a glowing edge. Keyword GENESIS_DISSOLVE. See Dissolve.

Returns GenesisFeature

GenesisFeature.Hologram
enum
GenesisFeature.Hologram

Scan-line, flicker, and Fresnel hologram effect. Keyword GENESIS_HOLOGRAM. See Hologram.

Returns GenesisFeature

GenesisFeature.HitEffect
enum
GenesisFeature.HitEffect

Animated damage flash. Keyword GENESIS_HIT_EFFECT. See Hit Effect.

Returns GenesisFeature

GenesisFeature.IntersectionGlow
enum
GenesisFeature.IntersectionGlow

Depth-based edge glow at surface intersections. Keyword GENESIS_INTERSECTION_GLOW. See Intersection Glow.

Returns GenesisFeature

GenesisFeature.VertexAnimation
enum
GenesisFeature.VertexAnimation

GPU vertex displacement modes. Keyword GENESIS_VERTEX_ANIMATION. See Vertex Animation.

Returns GenesisFeature

GenesisFeature.UVAnimation
enum
GenesisFeature.UVAnimation

UV scroll, wave, and distortion modes. Keyword GENESIS_UV_ANIMATION. See UV Animation.

Returns GenesisFeature

GenesisFeature.Outline
enum
GenesisFeature.Outline

Inverted-hull outline pass. Keyword GENESIS_OUTLINE. See Outline.

Returns GenesisFeature

Methods

GetKeyword(GenesisFeature)
static
public static string GetKeyword(GenesisFeature feature)

Returns the raw shader keyword string backing a feature, e.g. "GENESIS_DISSOLVE". Useful for building ShaderVariantCollection entries or LocalKeyword lookups.

Parameters

NameTypeDescription
featureGenesisFeatureThe feature to resolve.

Returns string

TryGetFeature(string, out GenesisFeature)
static
public static bool TryGetFeature(string keyword, out GenesisFeature feature)

Reverse lookup from a keyword string to its GenesisFeature. Returns false for keywords Genesis does not own.

Parameters

NameTypeDescription
keywordstringA shader keyword, e.g. "GENESIS_RIM".
featureout GenesisFeatureThe resolved feature when the method returns true.

Returns bool

Prewarm(GenesisFeature)
static
public static void Prewarm(GenesisFeature feature)

Forces the variant for a feature to compile and upload now, avoiding a first-use stall. Call during a loading screen, not in gameplay.

Parameters

NameTypeDescription
featureGenesisFeatureThe feature whose variant should be compiled ahead of time.

Returns void

PrewarmAll
static
public static void PrewarmAll(params GenesisFeature[] features)

Prewarms a batch of features in one call. Pass the set a scene actually toggles at runtime to keep the variant budget tight.

Parameters

NameTypeDescription
featuresGenesisFeature[]The features to compile ahead of time.

Returns void

GetActiveFeatures(Material)
static
public static GenesisFeature[] GetActiveFeatures(Material material)

Returns the features whose keywords are currently enabled on a material — handy for diagnostics and variant auditing.

Parameters

NameTypeDescription
materialMaterialA material using a Genesis shader.

Returns GenesisFeature[]

Examples

Prewarm the variants a scene toggles at runtime

using Genesis.Runtime; using UnityEngine; public class VariantWarmup : MonoBehaviour { [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] static void Warm() { GenesisKeywords.PrewarmAll( GenesisFeature.Dissolve, GenesisFeature.Hologram, GenesisFeature.HitEffect); } }

Build a ShaderVariantCollection entry from a feature

string keyword = GenesisKeywords.GetKeyword(GenesisFeature.IntersectionGlow); // keyword == "GENESIS_INTERSECTION_GLOW"

The most common shipping bug from this API: a script toggles a feature that was not present in any scene at build time, so its variant was stripped and must compile on demand — a visible hitch on slow GPUs. Prewarm aggressively, and prefer GenesisMaterial.EnableFeature over raw Material.EnableKeyword so the inspector and bookkeeping stay in sync.

See also

Last updated on