Class ScenePathSurfaceBinder
Hands the GPU a scene's paths: the page table and atlas of its ScenePathField, baked by the cut beside the terrain, as globals the terrain, the grass and the details read (FishGroundPaths.hlsl).
[ExecuteAlways]
[DisallowMultipleComponent]
[RequireComponent(typeof(ClientOnlyObject))]
public sealed class ScenePathSurfaceBinder : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourScenePathSurfaceBinder
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Baked, not built. The cut routes, carves and rasterises the paths (2026-10-10: "paths should be baked into the cut"); this only binds the two textures it wrote and the numbers that address them.
One scene's field at a time: the most recently enabled binder's. A world scene is loaded alone; the ground past its edge is the backdrop, which draws no paths.
Edit mode as play mode (ExecuteAlways): the Scene view, the world map's overhead capture and the
player all see the same paths.
Client only. The object carries ClientOnlyObject, so server builds strip it and the textures with it; in a server player this compiles to its serialized fields.
The path textures' slices in the terrain arrays differ per scene (each scene's palette), so they travel in each tile's property block (TerrainArrayBinder, LayersOf(Scene)), not as a global.
Fields
Atlas
[Tooltip("The baked atlas of pages: edge distance, half width, wear and surface, half a metre a texel.")]
public Texture2D Atlas
Field Value
- Texture2D
ObjectName
public const string ObjectName = "Path Surface"
Field Value
Parameters
[Tooltip("xy the world x/z of page (0, 0), z 1 / page metres, w the field's encoding when baked (ScenePathField.Encoding; 1 the first), 0 not.")]
public Vector4 Parameters
Field Value
- Vector4
Points
[Tooltip("The scene's points of interest, whose Paths were baked into the textures below.")]
public ScenePointsOfInterest Points
Field Value
Size
[Tooltip("xy the page table's size in pages, z 1 / the atlas's side in texels, w stored texels a page side.")]
public Vector4 Size
Field Value
- Vector4
Table
[Tooltip("The baked page table: a texel a 16 m page, r/g its place in the atlas, a set where a page is stored.")]
public Texture2D Table
Field Value
- Texture2D
Properties
Current
The binder whose field is bound, or null.
public static ScenePathSurfaceBinder Current { get; }
Property Value
DebugView
The terrain draws every path flat magenta (cyan where its surface slices are missing).
public static bool DebugView { get; set; }
Property Value
IsBaked
True when the bake left something to bind.
public bool IsBaked { get; }
Property Value
Methods
BindCompute(CommandBuffer, ComputeShader, int)
Binds the field to a compute kernel (compute shaders do not read the render globals): the grass and the detail scatter call this before they generate.
public static void BindCompute(CommandBuffer cmd, ComputeShader compute, int kernel)
Parameters
cmdCommandBuffercomputeComputeShaderkernelint
Describe()
What is bound, for the diagnostics: the binder, its field, the globals and the active scene's slices.
public static string Describe()
Returns
EarthMapOf(Scene)
Per terrain layer, its biome's path ground slice (−1 none), or null when the scene has no enabled binder. The terrain reads it from the layer table's paths row (TerrainLayerTable.RowPaths), which takes −1 past the map.
public static float[] EarthMapOf(Scene scene)
Parameters
sceneScene
Returns
- float[]
LayersOf(Scene)
The fallback path slices for a scene's terrain (x earth, y road, z cobbles; −1 none), or all −1 when it has no enabled binder.
public static Vector4 LayersOf(Scene scene)
Parameters
sceneScene
Returns
- Vector4
Publish()
Binds the current binder's field as the globals (or none).
public static void Publish()
RoadMapOf(Scene)
Per terrain layer, its biome's road ground slice, as EarthMapOf(Scene).
public static float[] RoadMapOf(Scene scene)
Parameters
sceneScene
Returns
- float[]
StoneMapOf(Scene)
Per terrain layer, its biome's cobble slice, as EarthMapOf(Scene): each biome's streets paved with its own stone. Null (−1 everywhere in the table) for a scene cut before the cobbles had a map, which paves with the scene's one slice (LayersOf(Scene).z) as it always did.
public static float[] StoneMapOf(Scene scene)
Parameters
sceneScene
Returns
- float[]