public sealed class MorphIndexA mesh's blend shapes re-indexed by vertex, so a vertex can be morphed by a gather instead of by a scatter.
Remarks
The form MorphTargetData is not, and the reason is the paged path. A target is a run of (vertex, Δ) sorted by vertex, which is what a scatter wants: one invocation per entry, writing the vertex it names. MorphRenderFeature dispatches exactly that, once per active shape, into a vertex buffer it owns per instance.
⚠ A virtualized mesh has no such buffer and cannot be given one. Its vertices live in MeshletPageSet's pages, and a page is per mesh — every instance of a head reads the same bytes out of the same pool slot, because that sharing is what makes streaming a hundred thousand clusters affordable. Weights are per instance. So there is nowhere for a per-instance scatter to write, short of giving every instance a private copy of every resident page it touches, and that is the one property the whole phase is built on. See doc 22 phase 2.
What the paged path does instead is what it already does for skinning: a gather, in the shader, per instance. ClusterRaster decodes a page vertex and then transforms it by that instance's bone palette — shared bytes, per-instance parameters, no intermediate buffer. Morphing is the same shape, and this is the table it needs: given a mesh vertex, which shapes move it and by how much.
⚠ A gather has no race and needs no barrier, which is the one thing it is strictly better at. MorphKernel has to dispatch per target because two shapes may move one vertex and there is no float atomic to arbitrate them; a gather sums a vertex's own shapes in one invocation and the question never arises. What it pays for that is the re-indexing — this type — and doing the sum again in every stage that decodes a vertex, which for the paged path is three shaders rather than the classic path's one pre-pass.
Built at registration rather than at import, and that is deliberate. Everything here is derived from MeshData.MorphTargets, which a build already ships; deriving it offline would be a second artefact, a second version fence and a second thing that can be stale against the first. It is O(entries) once per mesh, on the frame the mesh is registered, against deltas that were just deserialised.
Fields and properties (12)
public const int MaxShapesPerVertexHow many shapes may move one vertex.
public const int EntryWordsHow many 32-bit words one entry occupies, which is MorphKernel.EntryWords.
public string[] NamesWhat the mesh calls each of its shapes, in slot order.
public uint[] RunsWhere each vertex's entries start, with a trailing total — VertexCount + 1 of them.
public uint[] EntriesEvery entry, four words each, grouped by the vertex they move.
public float[] PositionStepsWhat one quantised position unit is worth, per shape.
public float[] NormalStepsWhat one quantised normal unit is worth, per shape.
public float[] ReachesHow far one shape moves the vertex it moves most, per shape.
public int VertexCountHow many vertices the mesh has, which is Runs's length less one.
public int ShapeCountHow many shapes it has.
public int EntryCountHow many entries there are in total.
public float MaxDisplacementHow far the mesh's shapes can move a vertex, if every one of them were at full weight.
Methods (4)
public static string? Refused(IReadOnlyList<MorphTargetData> targets, int vertexCount)The first shape that this type would refuse, or null when the mesh can be re-indexed.
public static MorphIndex? Build(IReadOnlyList<MorphTargetData> targets, int vertexCount)Re-indexes a mesh's shapes by vertex.
public float Radius(ReadOnlySpan<float> weights)How far these weights can move any vertex, in object space.
public void Apply(int vertex, ReadOnlySpan<float> weights, ref Vector3 position, ref Vector3 normal)Morphs one vertex by gathering its own shapes — the arithmetic the three cluster shaders do.
Used by (9)
- AssetVirtualGeometrySourceVixen.Engine.Renderer
- GpuClusterVisibilityVixen.Rendering
- MorphIndexTestsVixen.Rendering.Tests
- MorphedClusterTestsVixen.Rendering.Tests
- VirtualGeometryContentVixen.Rendering
- VirtualGeometryGoldenTestsVixen.Graphics.Golden.Tests
- VirtualGeometryRenderFeatureVixen.Rendering
- VirtualGeometrySystemVixen.Rendering
- ModelImporterVixen.Editor.Assets