Vixen
dd8b0a81

BlendShapeWeights

scene component Core/Vixen.Rendering/Ecs/MeshComponents.cs:202
csharp
public struct BlendShapeWeights

How much of each of a mesh's blend shapes an entity is wearing.

Read the guide page for this →

Remarks

One weight per MeshData.MorphTargets entry, in that order — which is the order the importer read them in, and the order MorphKernel.Apply and MorphScatter.rvn both use. A shorter array is read as zero for the rest, so an entity that only ever opens its jaw carries one number rather than twenty.

An array on a component, which most of them do not have. The count is the mesh's and a component is one size for every entity in a chunk, so the alternative is a fixed maximum written into the type — and a face is exactly the thing that has more shapes than anybody would have picked. AnimatorComponent holds a reference for the same reason.

⚠ Which makes this a managed component, and that changes how it is read. A chunk column holds a four-byte handle into the world's managed store rather than the array, so Chunk.ReadValues refuses it outright and a system reads one entity at a time — see MorphWeightSystem, which does, and SkinningSystem, which reads its animator the same way.

⚠ Read every frame, unlike everything else on a drawable. CastsShadows and StaticShadowCaster are read once at extraction and need Resettle to change; this is the opposite by construction, because a weight that could not change would not be a weight.

⚠ Null and empty are both "at rest", and neither is a mistake. A zeroed column is null — an entity that gained the component and has not been given values — and the frame draws it unmorphed rather than refusing it.

Fields and properties (2)

  • public float[]? Weights

    The weights, or null for none.

  • public string[]? Shapes

    What the mesh calls each slot of Weights, or null until something says.

Used by (11)

  • PbrShowcaseGamePbrShowcase
  • BlendShapeAnimationSystemVixen.Animation
  • BlendShapeTrackTestsVixen.Animation.Tests
  • ComponentRegistrationVixen.Rendering
  • CompositorImageTestsVixen.Graphics.Golden.Tests
  • MorphRenderFeatureTestsVixen.Rendering.Tests
  • MorphWeightSystemVixen.Rendering
  • MorphedClusterTestsVixen.Rendering.Tests
  • TypeRegistrationVixen.Rendering
  • Vixen_Rendering_Ecs_BlendShapeWeightsSerializerVixen.Rendering
  • MaterialIconsVixen.Editor.App