Skip to Content
DocumentationScripting APIMaps & UV API

GenesisMaps

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

GenesisMaps groups the texture and UV controls of a Genesis material — albedo, normal, detail, and layer maps, plus per-slot tiling, offset, and UV channel selection. It is accessed through GenesisMaterial.Maps, making runtime texture swaps and biome streaming type-safe.

using Genesis.Runtime; var gm = new GenesisMaterial(GetComponent<Renderer>()); gm.Maps.SetAlbedo(grassAlbedo); gm.Maps.SetNormal(grassNormal, 1.2f); gm.Maps.SetTiling(new Vector2(4f, 4f)); gm.Apply();

Texture references cannot travel through a MaterialPropertyBlock on every SRP path, so SetAlbedo/SetNormal may write to the shared material. Group renderers that need different textures onto different materials, or use Layer Textures and blend masks instead of per-instance swaps.

Properties

NormalStrength
property
public float NormalStrength { get; set; }

Multiplier on the normal map XY components, 0 (flat) to 2 (exaggerated). Maps to _BumpScale. See Normal Mapping.

Returns float

DetailStrength
property
public float DetailStrength { get; set; }

Strength of the detail texture layer, 02. Maps to _DetailNormalScale.

Returns float

Tiling
property
public Vector2 Tiling { get; set; }

Base-map UV tiling. Maps to the xy of the main texture’s _ST vector.

Returns Vector2

Offset
property
public Vector2 Offset { get; set; }

Base-map UV offset. Maps to the zw of the main texture’s _ST vector.

Returns Vector2

Methods

SetAlbedo(Texture2D)
method
public void SetAlbedo(Texture2D texture)

Assigns the base albedo texture. Maps to _BaseMap / _MainTex.

Parameters

NameTypeDescription
textureTexture2DThe albedo / base color map. Null clears the slot to white.

Returns void

SetNormal(Texture2D, float)
method
public void SetNormal(Texture2D normal, float strength = 1f)

Assigns the tangent-space normal map and its strength, enabling the GENESIS_NORMAL_MAP keyword. See Normal Mapping.

Parameters

NameTypeDescription
normalTexture2DDXT5nm or BC5 tangent-space normal map. Maps to _BumpMap.
strengthfloatXY multiplier, 0–2. Defaults to 1.

Returns void

SetDetail(Texture2D, Texture2D, Vector2)
method
public void SetDetail(Texture2D albedo, Texture2D normal, Vector2 tiling)

Assigns detail albedo and normal maps at the given secondary tiling, enabling the GENESIS_DETAIL_TEXTURES keyword. See Detail Textures.

Parameters

NameTypeDescription
albedoTexture2DDetail albedo, blended with an overlay-style mix. May be null.
normalTexture2DDetail normal, combined via Reoriented Normal Mapping. May be null.
tilingVector2Secondary UV tiling. Maps to the xy of _DetailTiling.

Returns void

SetLayer(int, Texture2D, Vector4)
method
public void SetLayer(int index, Texture2D texture, Vector4 tilingOffset)

Assigns one of the additive layer textures and its tiling/offset, enabling the GENESIS_LAYER_TEXTURES keyword.

Parameters

NameTypeDescription
indexintLayer slot, 1–3.
textureTexture2DThe layer texture. Maps to _Layer{index}Tex.
tilingOffsetVector4Tiling (xy) and offset (zw). Maps to _Layer{index}Tiling.

Returns void

SetTiling(Vector2, Vector2)
method
public void SetTiling(Vector2 tiling, Vector2 offset = default)

Sets the base-map UV tiling and offset together.

Parameters

NameTypeDescription
tilingVector2UV scale; 1 = one tile per UV unit.
offsetVector2UV offset. Defaults to (0,0).

Returns void

SetUVChannel(GenesisUVChannel)
method
public void SetUVChannel(GenesisUVChannel channel)

Selects which mesh UV channel the base map samples from. Useful for lightmapped or atlas meshes.

Parameters

NameTypeDescription
channelGenesisUVChannelUV0, UV1, UV2, or UV3.

Returns void

Examples

Swap a material to a snow biome

using Genesis.Runtime; using UnityEngine; public class BiomeSwap : MonoBehaviour { [SerializeField] Renderer target; [SerializeField] Texture2D snowAlbedo, snowNormal; public void ToSnow() { var gm = new GenesisMaterial(target); gm.Maps.SetAlbedo(snowAlbedo); gm.Maps.SetNormal(snowNormal, 0.8f); gm.Maps.SetTiling(new Vector2(6f, 6f)); gm.Apply(); gm.Dispose(); } }

Add a moss detail layer

public void AddMoss(GenesisMaterial gm, Texture2D mossA, Texture2D mossN) { gm.Maps.SetDetail(mossA, mossN, new Vector2(12f, 12f)); gm.Maps.DetailStrength = 0.7f; gm.Apply(); }

Frequent runtime texture swaps fragment batches and can trigger streaming hitches. For variation across many instances prefer Layer Textures or Triplanar with masks over swapping _BaseMap per renderer.

See also

Last updated on