Docs

Textures and landmarks

Sampling a Texture pin, and reading or writing a Landmarks pin.

Part of the Wrangle reference. Everything on this page goes in the node's Code field, and runs once per element of the current Run Over mode.

Textures

Read a Texture input pin by name - legal in every domain, including Texel.

Syntax What it does Example
Texture parameter Add a Parameter of type Texture and it becomes an input pin - a plain object pin, wire it a texture exactly like Load Texture From File's own output. No bare-read or ch()-family form: a Texture parameter is only ever read through the functions below, by its pin name in quotes. Parameters list, type Texture, name "Albedo"
pin names "Albedo" Every function below takes the texture pin's name as its first argument, a string literal in quotes. Naming a pin that does not exist, or one that is not currently wired, is a compile error: No texture input named X is connected. Cd = texture("Albedo", uv.x, uv.y)
texture("Pin", u, v) Bilinear sample, linear colour space, as a vector (rgb). u/v outside [0,1] wrap (a tiling texture stays continuous across the seam), matching every other texture consumer in this app. Cd = texture("Albedo", uv.x, uv.y)
texturea("Pin", u, v) The same bilinear sample's alpha, alone. Cd.a = texturea("Albedo", uv.x, uv.y)
v origin v=0 is the top row of the image, the UE-native convention - a UV of (0,0) addresses the top-left texel, the same as every other texture consumer in this app (the UV-layout renderer, Project Texture). wmap("Weights") = texturea("Stencil", uv.x, uv.y)
texel("Pin", x, y) Unfiltered read of one integer texel, as a vector (rgb) - no interpolation. x/y outside the image clamp to the nearest edge texel and count an out-of-range guard, unlike texture()'s wrap. vector c = texel("Albedo", texelx(), texely())
texwidth("Pin") The texture's native width in texels. float u = texelx() / texwidth("Albedo")
texheight("Pin") The texture's native height in texels. float v = texely() / texheight("Albedo")

Landmarks

Read a Landmarks input pin by name - legal in every Run Mode.

Syntax What it does Example
Landmarks parameter Add a Parameter of type Landmarks and it becomes an input pin (the same "Landmarks" struct every landmark tool in this app uses). No bare-read form: read it through the functions below, by pin name in quotes. Parameters list, type Landmarks, name "Guide"
pin names "Guide" Every function below takes the pin's name as its first argument, a string literal in quotes. Naming a pin that does not exist, or one that is not currently wired, is a compile error: No Landmarks input named X is connected. wmap("Weights") = numlandmarks("Guide")
numlandmarks("Pin") Source/target pair count of the named pin. for (i = 0; i < numlandmarks("Guide"); i += 1) { s += landmarksrc("Guide", i) }
landmarksrc("Pin", i) Source position of pair i, as a vector. An out-of-range i returns the zero vector and is counted, like every other point-index guard in this language. vector s0 = landmarksrc("Guide", 0)
landmarkdst("Pin", i) Target position of pair i, as a vector. Same out-of-range convention. vector d0 = landmarkdst("Guide", 0)
nearlandmark("Pin", p) Index of the source landmark nearest p by Euclidean distance, or -1 when the pin has no pairs. Ties break to the lowest index, so the answer is the same on every run. float i = nearlandmark("Guide", P); P = lerp(P, landmarkdst("Guide", i), 0.5)
numsplines("Pin") How many spline pairs the named Landmarks pin carries. Legal in every run-over. wmap("Weights") = numsplines("Guide")
splinesample("Pin", u) / splinesample("Pin", i, u) Sample a source spline polyline at u in [0,1] by cumulative length (index lerp if length is 0). Prefers baked samples, else control points. Empty or out of range -> zero vector (counted). vector p = splinesample("Guide", 0.5)
splinesampledst("Pin", i, u) Same for a dest spline. vector q = splinesampledst("Guide", 0, 0.5)

Index order

Pairs are indexed in a canonical order - lexicographic by source position (X, then Y, then Z), ties broken lexicographically by destination position - not the pin's own internal storage order (not stable across a save/load round trip) and not the order they were placed in (a map does not remember that). Two pins with the same pairs always agree with each other, and with themselves after a save/load; do not assume index 0 is "the first one you placed".