mx_place2d
Transforms a 2D texcoord in a fixed order: translate by pivot → scale → rotate (degrees) → translate back, then add offset; returns the transformed UV. Mirrors MaterialX “place2d”.
Core Advantages
Unifies pivot/scale/rotate/offset in one node with a consistent operation order. No manual mat2 or degree–radian math; easily driven by time/uniform nodes and reused across materials.
Common Uses
Centered texture rotation (animate rotate with time).
Tiling/zoom via scale (with RepeatWrapping).
UV scrolling via time‑driven offset.
Precise anchoring around any UV pivot.
Texture atlas: scale=vec2(1/cols,1/rows), offset selects the cell.
Decal/label alignment using pivot and offset.
How to adjust
Parameters: texcoord, pivot (default 0.5,0.5), scale (1,1), rotate in degrees (0), offset (0,0). Order is fixed: −pivot → scale → rotate → +pivot → +offset. Tips: rotate animation with time.mul(45); tiling via scale=vec2(tx,ty) (use RepeatWrapping); atlas with scale=vec2(1/cols,1/rows) and per‑tile offset; set pivot to the desired anchor for rotation/scaling.
Code Examples
1
2// Scale 1.2× around center, rotate 30°, then shift right by 0.1
3const uvTr = mx_place2d(
4 uv(),
5 vec2( 0.5, 0.5 ),
6 vec2( 1.2, 1.2 ),
7 float( 30.0 ),
8 vec2( 0.1, 0.0 )
9);
10material.colorNode = texture( myMap, uvTr );
11