SOMA¶
SOMA provides a native implementation for SOMA-X assets with identity, pose, and corrective controls.
Setup¶
SOMA downloads automatically on first use from https://huggingface.co/abcamiletto/body-models.
The Hugging Face repo records the original SOMA-X Apache 2.0 provenance. To prefetch and save the path:
# Download the SOMA-X assets used by the native SOMA implementation.
body-models download soma
Notes¶
The native implementation does not require installing py-soma-x.
body-models supports both the legacy SOMA-X NPZ rig asset layout and the SOMA-X 0.2 asset split, where rig data lives in SOMA_template_rig.usda and public-rig derivation metadata lives in SOMA_procedural_transforms.json. With 0.2 assets, the native backend keeps the expanded internal twist-joint rig for skinning while preserving the existing 77-joint public pose API.
The constructor accepts lod="mid", lod="low", or lod="xlo". The hosted assets are preprocessed to keep runtime loading NPZ-only: mid has 18,056 vertices, low has 4,505 vertices, and xlo has 612 vertices.
prepare_identity(..., repose=True) matches the default SOMA-X bind-pose behavior. Pass repose=False to keep the fitted identity rest shape and fitted skeleton before reposing it to the bind pose.
Use prepare_identity(..., bind_pose="fit") for the default identity-dependent bind pose. Pass bind_pose="fit_detached" to fit from the current shape without gradients through the fit, or bind_pose="canonical" to use the model bind pose directly.
cache_identity=True can be passed to the constructor for interactive viewers that repeatedly evaluate the same identity with different poses. The default is False, which keeps training and JAX-transformed calls graph-safe unless caching is explicitly requested.
API¶
body_models.bodies.soma.numpy.SOMA
¶
SOMA(
model_path=None,
*,
model_type="soma",
lod="mid",
simplify=1.0,
rotation_type="axis_angle",
match_warp=True,
kernel="scipy",
)
Bases: SkinnedModel
SOMA body model with NumPy backend.
Initialize the SOMA model.
| PARAMETER | DESCRIPTION |
|---|---|
model_path
|
Path to model assets, or the default assets when omitted.
TYPE:
|
model_type
|
SOMA identity/model variant to load.
TYPE:
|
lod
|
Body mesh level of detail: "mid", "low", or "xlo".
TYPE:
|
simplify
|
Mesh simplification factor to apply while loading.
TYPE:
|
rotation_type
|
Rotation representation expected by pose inputs.
TYPE:
|
match_warp
|
Whether to match Warp backend numerical conventions.
TYPE:
|
kernel
|
Backend kernel used for forward evaluation.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
forward_vertices |
Compute posed mesh vertices. |
forward_skeleton |
Compute posed joint transforms. |
prepare_identity |
Precompute identity-dependent SOMA state for repeated forward passes. |
prepare_pose |
Precompute local pose-dependent state for repeated forward passes. |
joint_index |
Resolve a standard joint to this model's native joint index. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
common_joints |
Common anatomical joints mapped to this model's native joint names.
TYPE:
|
Source code in src/body_models/bodies/soma/numpy.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
common_joints
property
¶
common_joints
Common anatomical joints mapped to this model's native joint names.
forward_vertices
¶
forward_vertices(
body_pose,
head_pose,
hand_pose,
global_rotation=None,
*,
shape=None,
scale_params=None,
identity=None,
global_translation=None,
vertex_indices=None,
)
Compute posed mesh vertices.
| PARAMETER | DESCRIPTION |
|---|---|
body_pose
|
Local body joint rotations.
TYPE:
|
head_pose
|
Local head and facial joint rotations.
TYPE:
|
hand_pose
|
Local hand joint rotations.
TYPE:
|
global_rotation
|
Global model rotation.
TYPE:
|
shape
|
Identity coefficients.
TYPE:
|
scale_params
|
Per-part scale parameters.
TYPE:
|
identity
|
Optional output from :meth:
TYPE:
|
global_translation
|
Global model translation.
TYPE:
|
vertex_indices
|
Optional subset of vertices to return.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Float[ndarray, 'B V 3']
|
Posed vertex positions. |
Source code in src/body_models/bodies/soma/numpy.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
forward_skeleton
¶
forward_skeleton(
body_pose,
head_pose,
hand_pose,
global_rotation=None,
*,
shape=None,
scale_params=None,
identity=None,
global_translation=None,
joint_indices=None,
)
Compute posed joint transforms.
| PARAMETER | DESCRIPTION |
|---|---|
body_pose
|
Local body joint rotations.
TYPE:
|
head_pose
|
Local head and facial joint rotations.
TYPE:
|
hand_pose
|
Local hand joint rotations.
TYPE:
|
global_rotation
|
Global model rotation.
TYPE:
|
shape
|
Identity coefficients.
TYPE:
|
scale_params
|
Per-part scale parameters.
TYPE:
|
identity
|
Optional output from :meth:
TYPE:
|
global_translation
|
Global model translation.
TYPE:
|
joint_indices
|
Optional subset of joints to return.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Float[ndarray, 'B 77 4 4']
|
Joint transforms in the model hierarchy. |
Source code in src/body_models/bodies/soma/numpy.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
prepare_identity
¶
prepare_identity(
shape,
*,
scale_params=None,
skip_vertices=False,
repose=True,
bind_pose="fit",
)
Precompute identity-dependent SOMA state for repeated forward passes.
Source code in src/body_models/bodies/soma/numpy.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
prepare_pose
¶
prepare_pose(
body_pose, head_pose, hand_pose, *, identity, skip_vertices=False
)
Precompute local pose-dependent state for repeated forward passes.
Source code in src/body_models/bodies/soma/numpy.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
joint_index
¶
joint_index(joint)
Resolve a standard joint to this model's native joint index.
Source code in src/body_models/base.py
63 64 65 66 67 68 69 70 71 | |