Docs / Fabric simulation

Glossary: FabricSeamVertex

The fields of FabricSeamVertex, in alphabetical order.

A lip vertex of a cut mesh: a point of the flat sheet that the vertex shader blends from particles on its own side of the cut, so the lips part as the rip opens.

A struct of public fields, 32 bytes, laid out field for field as FabricSeamVertex in FabricParticleBuffer.fxh; read from FabricCutMesh.SeamVertices, which the library fills. Upload them as they are, to a StructuredBuffer made with typeof(FabricSeamVertex). The cuts page shows it in context, with code.

One layout holds two kinds of blend:

  • Three carriers, the usual case. The weights are the point’s barycentric weights of particles A, B and C on the flat sheet. They sum to 1 but often leave the range 0 to 1, since the carriers needn’t surround the lip: exact for cloth that moves rigidly, close for cloth that bends smoothly.
  • Two carriers, marked by IndexC equal to IndexA, which a three-carrier blend never has. It skins cloth whose reachable particles all lie on one line, such as the single row left between two cuts about a cell apart. The flat point is A + t (B - A) + s CCW(B - A), where CCW(x, y) = (-y, x), stored as WeightA = 1 - t, WeightB = t and WeightC = s. The shader blends A and B by their weights and adds WeightC times cross(normal, positionB - positionA), which turns B - A across the cloth the way CCW turns it on the flat sheet.

Fields

IndexA →

uint · The first carrier particle, by ParticleIndex. Its normal is what the shader falls back to when the blended normal cancels out.

IndexB →

uint · The second carrier particle.

IndexC →

uint · The third carrier particle, or IndexA again for a two-carrier blend.

SizeInBytes →

int · Constant, 32. The size of one record, which must equal the stride the shader declares.

TexCoord →

Vector2 · The vertex’s texture coordinate, in the convention of FabricTextureCoordinates. Stored rather than worked out, since a seam vertex has no place in the grid to work it out from.

WeightA →

float · A’s share: its barycentric weight, or 1 - t with two carriers.

WeightB →

float · B’s share: its barycentric weight, or t with two carriers.

WeightC →

float · C’s barycentric weight, or with two carriers s, the offset across the line of the two, in multiples of the gap between them.