Skip to main content

Deformation System

Rukhanka Animation's deformation system applies skinning and blend shapes to skinned meshes for rendering with Entities Graphics. Animation processing supplies skin matrices and blend shape weights; deformation uses them to produce vertex positions, normals, and tangents on the GPU. Both CPU and GPU animation engines use this rendering path.

Skinning Modes​

Rukhanka Animation supports two deformation paths:

  • In-place skinning performs deformation in the mesh vertex shader on every render pass. This avoids an intermediate deformed vertex buffer, at the cost of repeating work for depth, shadows, and other passes. It is enabled by default in current releases.
  • Preskinning uses compute shaders to prepare vertex workloads and deform visible meshes into a buffer that render passes reuse. Dispatch count depends on workload size and hardware limits; it is not necessarily exactly two dispatches per frame.

Select the mode in Project Settings and compare the tradeoffs in In-place Skinning. Animation engine selection is independent of this setting.

Rendering Requirements​

Use a Rukhanka Animation deformation-aware shader on each skinned material. Unity's Entities Graphics deformation node is no longer supported. Regular materials do not apply the animation data to vertices.

The deformation pipeline supports visibility and LOD filtering, so it can avoid deforming meshes that do not need rendering. Configure animation culling and bounds together; animation culling and mesh visibility are related but separate decisions.

Runtime Mesh and Material Changes​

Current baking uses the native Entities Graphics render mesh pipeline. Multiple entities in the same scene section can share a RenderMeshArray. When changing MaterialMeshInfo, resolve the mesh and material indices against the target entity's current array. Do not assume that a skinned mesh is always at index zero or has its own array.

Single-material renderers use direct indices. Multi-material renderers use index ranges by default; One Entity Per Submesh produces separate entities with direct indices. See Upgrading Rukhanka Animation when migrating older mesh-replacement code, and Runtime Skinned Mesh Replacement for a modular rig example.