Docs
Materials
How the pipe material keeps textures tiling as pipes stretch.
The pipe between two junctions is a single mesh, stretched to whatever length the span needs. This page explains why that does not smear the texture: the material is told how much each piece was stretched and repeats the texture to match, so pipes tile automatically at any length.
Stretching without smearing
When a run needs a 3 m pipe from a 1 m mesh, the renderer scales the mesh 3x along its length. On its own, that would stretch the texture 3x too. So PipeIt hands the material the stretch factor, and the material counter-stretches its UVs: the texture repeats three times instead of smearing once across the span. Texel density stays constant no matter how long the pipe is.
The same mechanism sizes bracket arms - a bracket’s line piece is stretched from the clamp to the surface, and its texture tiles the same way.
The numbers: Custom Primitive Data
Every rendered piece carries two floats of Custom Primitive Data (CPD) - per-piece values that a material can read, in every render mode:
| Slot | Name | Value |
|---|---|---|
CPD[0] | StretchU | How much the piece is stretched along its length: the actual span length divided by the mesh’s natural length at its current mesh scale. 1.0 on unstretched pieces (junctions, caps). |
CPD[1] | Mesh Multiplier | The network’s cross-section scale (its Mesh Scale Multiplier). Lets a material keep texel density, normal-map intensity, or wear masks consistent when pipes get thicker or thinner. |
The pipe material
The plugin’s pipe master material is M_PipeIt_Standard. It has an Is Pipe
static switch; with it enabled, the material multiplies the U texture coordinate by
CPD[0]. A pipe stretched to three times its natural length samples the texture
three times along its length - that is the whole trick.
Because unstretched pieces carry StretchU = 1.0, the multiply is a no-op on
junctions and caps, and the same material works on every piece of the kit.
Using the mechanism in your own materials
If your kit uses your own pipe material, stretched pipes will smear its texture until the material compensates. Two ways to get there:
- Parent it to M_PipeIt_Standard: make a material instance, keep Is Pipe enabled, and override the textures.
- Add the node yourself: in your material, multiply the U of your texture coordinates by CPD slot 0 (a CustomPrimitiveData node with index 0). Use slot 1 if the look should adapt to pipe thickness too.
Baking
A baked static mesh has no per-piece CPD, so Baking & Exporting folds the stretch into the baked geometry: each section’s UVs are pre-multiplied by its StretchU, and pipe materials are swapped for instances with Is Pipe disabled so the compensation is not applied twice. This happens automatically; it is mentioned here so the material switch does not surprise you.