Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
usd_animation_io.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
9
11
13#include "momentum/common/log.h"
15
16#include <pxr/base/tf/staticTokens.h>
17
18#include <pxr/base/gf/half.h>
19#include <pxr/base/gf/quatf.h>
20#include <pxr/base/gf/vec3d.h>
21#include <pxr/base/gf/vec3f.h>
22#include <pxr/base/gf/vec3h.h>
23#include <pxr/base/vt/array.h>
24#include <pxr/usd/sdf/valueTypeName.h>
25#include <pxr/usd/usd/primRange.h>
26#include <pxr/usd/usdGeom/scope.h>
27#include <pxr/usd/usdGeom/xform.h>
28#include <pxr/usd/usdGeom/xformCommonAPI.h>
29#include <pxr/usd/usdSkel/animation.h>
30#include <pxr/usd/usdSkel/bindingAPI.h>
31
32#include <cmath>
33#include <unordered_map>
34#include <unordered_set>
35
36PXR_NAMESPACE_USING_DIRECTIVE
37
39 _tokens,
40 (Animation)(Markers)((momentumMotionFps, "momentum:motion:fps"))(
41 (momentumMotionParameterNames,
42 "momentum:motion:parameterNames"))((momentumMotionPoses, "momentum:motion:poses"))(
43 (momentumMotionNumFrames,
44 "momentum:motion:numFrames"))((momentumMotionNumParams, "momentum:motion:numParams"))(
45 (momentumMotionJointNames,
46 "momentum:motion:jointNames"))((momentumMotionOffsets, "momentum:motion:offsets"))(
47 (momentumMarkerName,
48 "momentum:marker:name"))((momentumMarkerOccluded, "momentum:marker:occluded"))(
49 (momentumMarkerConfidence,
50 "momentum:marker:confidence"))((momentumMarkersFps, "momentum:markers:fps")));
51
52namespace momentum {
53
55 const UsdStageRefPtr& stage,
56 UsdSkelSkeleton& skelPrim,
57 const Skeleton& skeleton,
58 std::span<const SkeletonState> skeletonStates,
59 float fps) {
60 MT_CHECK(!skeletonStates.empty());
61
62 const auto numJoints = skeleton.joints.size();
63
64 // Create animation prim
65 auto animPath = skelPrim.GetPath().AppendChild(_tokens->Animation);
66 auto animPrim = UsdSkelAnimation::Define(stage, animPath);
67
68 // Set joint order to match skeleton (must use hierarchical paths to match
69 // the Skeleton prim's joints attribute, otherwise UsdSkel won't bind)
70 const auto paths = buildHierarchicalPaths(skeleton);
71 VtArray<TfToken> jointTokens;
72 jointTokens.reserve(numJoints);
73 for (const auto& path : paths) {
74 jointTokens.push_back(TfToken(path));
75 }
76 animPrim.GetJointsAttr().Set(jointTokens);
77
78 // Bind animation to skeleton
79 UsdSkelBindingAPI bindingAPI = UsdSkelBindingAPI::Apply(skelPrim.GetPrim());
80 bindingAPI.GetAnimationSourceRel().SetTargets({animPath});
81
82 // Set stage time range
83 const double startTime = 0.0;
84 const auto endTime = static_cast<double>(skeletonStates.size() - 1);
85 stage->SetStartTimeCode(startTime);
86 stage->SetEndTimeCode(endTime);
87 stage->SetTimeCodesPerSecond(static_cast<double>(fps));
88
89 // Write time-sampled TRS per frame
90 VtArray<GfVec3f> translations;
91 VtArray<GfQuatf> rotations;
92 VtArray<GfVec3h> scales;
93 translations.reserve(numJoints);
94 rotations.reserve(numJoints);
95 scales.reserve(numJoints);
96
97 auto translationsAttr = animPrim.GetTranslationsAttr();
98 auto rotationsAttr = animPrim.GetRotationsAttr();
99 auto scalesAttr = animPrim.GetScalesAttr();
100
101 for (size_t frame = 0; frame < skeletonStates.size(); ++frame) {
102 const auto& state = skeletonStates[frame];
103 const auto timeCode = UsdTimeCode(static_cast<double>(frame));
104
105 translations.clear();
106 rotations.clear();
107 scales.clear();
108
109 for (size_t j = 0; j < numJoints; ++j) {
110 const auto& localTransform = state.jointState[j].localTransform;
111
112 const auto& t = localTransform.translation;
113 translations.push_back(GfVec3f(t.x(), t.y(), t.z()));
114
115 const auto& q = localTransform.rotation;
116 rotations.push_back(GfQuatf(q.w(), q.x(), q.y(), q.z()));
117
118 const GfHalf s = static_cast<GfHalf>(localTransform.scale);
119 scales.push_back(GfVec3h(s, s, s));
120 }
121
122 translationsAttr.Set(translations, timeCode);
123 rotationsAttr.Set(rotations, timeCode);
124 scalesAttr.Set(scales, timeCode);
125 }
126}
127
128std::tuple<std::vector<SkeletonState>, std::vector<float>> loadSkeletonStatesFromUsd(
129 const UsdStageRefPtr& stage,
130 const Skeleton& skeleton) {
131 std::vector<SkeletonState> states;
132 std::vector<float> frameTimes;
133
134 const auto numJoints = skeleton.joints.size();
135
136 // Find animation prim
137 for (const auto& prim : stage->Traverse()) {
138 if (!prim.IsA<UsdSkelAnimation>()) {
139 continue;
140 }
141
142 UsdSkelAnimation animPrim(prim);
143
144 const double tps = stage->GetTimeCodesPerSecond();
145 if (tps <= 0.0) {
146 break;
147 }
148
149 // Query time samples from the animation
150 std::vector<double> timeSamples;
151 animPrim.GetTranslationsAttr().GetTimeSamples(&timeSamples);
152 if (timeSamples.empty()) {
153 break;
154 }
155
156 states.reserve(timeSamples.size());
157 frameTimes.reserve(timeSamples.size());
158
159 VtArray<GfVec3f> translations;
160 VtArray<GfQuatf> rotations;
161 VtArray<GfVec3h> scales;
162
163 auto translationsAttr = animPrim.GetTranslationsAttr();
164 auto rotationsAttr = animPrim.GetRotationsAttr();
165 auto scalesAttr = animPrim.GetScalesAttr();
166
167 for (const double sample : timeSamples) {
168 const auto timeCode = UsdTimeCode(sample);
169
170 translationsAttr.Get(&translations, timeCode);
171 rotationsAttr.Get(&rotations, timeCode);
172 scalesAttr.Get(&scales, timeCode);
173
174 // Reconstruct joint parameters from TRS
176
177 for (size_t j = 0; j < numJoints; ++j) {
178 const size_t base = j * kParametersPerJoint;
179 const auto& joint = skeleton.joints[j];
180
181 // Translation: subtract translationOffset to get the parameter delta
182 if (j < translations.size()) {
183 jointParams[base + 0] = translations[j][0] - joint.translationOffset.x();
184 jointParams[base + 1] = translations[j][1] - joint.translationOffset.y();
185 jointParams[base + 2] = translations[j][2] - joint.translationOffset.z();
186 }
187
188 // Rotation: remove preRotation then convert to euler angles (ZYX convention)
189 if (j < rotations.size()) {
190 const auto& gfQ = rotations[j];
191 Eigen::Quaternionf fullRotation(
192 gfQ.GetReal(), gfQ.GetImaginary()[0], gfQ.GetImaginary()[1], gfQ.GetImaginary()[2]);
193
194 // The saved rotation is preRotation * Rz * Ry * Rx, so remove preRotation
195 Eigen::Quaternionf jointRotation = joint.preRotation.inverse() * fullRotation;
196 Eigen::Vector3f euler = quaternionToEuler(jointRotation);
197 jointParams[base + 3] = euler[0];
198 jointParams[base + 4] = euler[1];
199 jointParams[base + 5] = euler[2];
200 }
201
202 // Scale: take log2 to get the parameter (forward: scale = exp2(param))
203 if (j < scales.size()) {
204 const auto scaleVal = static_cast<float>(scales[j][0]);
205 jointParams[base + 6] = scaleVal > 0.0f ? std::log2(scaleVal) : 0.0f;
206 }
207 }
208
209 states.emplace_back(std::move(jointParams), skeleton, false);
210 frameTimes.push_back(static_cast<float>(sample / tps));
211 }
212
213 break; // Use first animation found
214 }
215
216 return {std::move(states), std::move(frameTimes)};
217}
218
220 const UsdPrim& prim,
221 float fps,
222 const MotionParameters& motion,
223 const IdentityParameters& offsets) {
224 const auto& [paramNames, poses] = motion;
225 const auto& [jointNames, offsetValues] = offsets;
226
227 if (paramNames.empty() || poses.cols() == 0) {
228 return;
229 }
230
231 prim.CreateAttribute(_tokens->momentumMotionFps, SdfValueTypeNames->Float).Set(fps);
232
233 // Save parameter names as string array
234 VtArray<std::string> paramNamesArray(paramNames.begin(), paramNames.end());
235 prim.CreateAttribute(_tokens->momentumMotionParameterNames, SdfValueTypeNames->StringArray)
236 .Set(paramNamesArray);
237
238 // Save poses matrix as flat float array (column-major: numParams * numFrames)
239 const Eigen::Index numParams = poses.rows();
240 const Eigen::Index numFrames = poses.cols();
241 VtArray<float> posesArray(numParams * numFrames);
242 for (Eigen::Index f = 0; f < numFrames; ++f) {
243 for (Eigen::Index p = 0; p < numParams; ++p) {
244 posesArray[f * numParams + p] = poses(p, f);
245 }
246 }
247 prim.CreateAttribute(_tokens->momentumMotionPoses, SdfValueTypeNames->FloatArray).Set(posesArray);
248 prim.CreateAttribute(_tokens->momentumMotionNumFrames, SdfValueTypeNames->Int)
249 .Set(static_cast<int>(numFrames));
250 prim.CreateAttribute(_tokens->momentumMotionNumParams, SdfValueTypeNames->Int)
251 .Set(static_cast<int>(numParams));
252
253 // Save identity offsets
254 if (!jointNames.empty() && offsetValues.size() > 0) {
255 VtArray<std::string> jointNamesArray(jointNames.begin(), jointNames.end());
256 prim.CreateAttribute(_tokens->momentumMotionJointNames, SdfValueTypeNames->StringArray)
257 .Set(jointNamesArray);
258
259 VtArray<float> offsetsArray(offsetValues.size());
260 for (Eigen::Index i = 0; i < offsetValues.size(); ++i) {
261 offsetsArray[i] = offsetValues[i];
262 }
263 prim.CreateAttribute(_tokens->momentumMotionOffsets, SdfValueTypeNames->FloatArray)
264 .Set(offsetsArray);
265 }
266}
267
268std::tuple<MotionParameters, IdentityParameters, float> loadMotionFromUsd(const UsdPrim& prim) {
269 MotionParameters motion;
270 IdentityParameters identity;
271 float fps = 120.0f;
272
273 auto fpsAttr = prim.GetAttribute(_tokens->momentumMotionFps);
274 if (!fpsAttr) {
275 return {motion, identity, fps};
276 }
277 fpsAttr.Get(&fps);
278
279 int numFrames = 0;
280 int numParams = 0;
281 prim.GetAttribute(_tokens->momentumMotionNumFrames).Get(&numFrames);
282 prim.GetAttribute(_tokens->momentumMotionNumParams).Get(&numParams);
283
284 if (numFrames <= 0 || numParams <= 0) {
285 return {motion, identity, fps};
286 }
287
288 // Load parameter names
289 VtArray<std::string> paramNamesArray;
290 if (auto attr = prim.GetAttribute(_tokens->momentumMotionParameterNames); attr) {
291 attr.Get(&paramNamesArray);
292 }
293 auto& [paramNames, poses] = motion;
294 paramNames.assign(paramNamesArray.begin(), paramNamesArray.end());
295
296 // Load poses matrix
297 VtArray<float> posesArray;
298 if (auto attr = prim.GetAttribute(_tokens->momentumMotionPoses); attr) {
299 attr.Get(&posesArray);
300 }
301
302 const auto expectedSize = static_cast<size_t>(numParams) * static_cast<size_t>(numFrames);
303 if (posesArray.size() == expectedSize) {
304 poses.resize(numParams, numFrames);
305 for (int f = 0; f < numFrames; ++f) {
306 for (int p = 0; p < numParams; ++p) {
307 poses(p, f) = posesArray[f * numParams + p];
308 }
309 }
310 } else {
311 MT_LOGW(
312 "Poses array size ({}) does not match numParams * numFrames ({} * {})",
313 posesArray.size(),
314 numParams,
315 numFrames);
316 }
317
318 // Load identity offsets
319 auto& [jointNames, offsetValues] = identity;
320
321 VtArray<std::string> jointNamesArray;
322 if (auto attr = prim.GetAttribute(_tokens->momentumMotionJointNames); attr) {
323 attr.Get(&jointNamesArray);
324 }
325 jointNames.assign(jointNamesArray.begin(), jointNamesArray.end());
326
327 VtArray<float> offsetsArray;
328 if (auto attr = prim.GetAttribute(_tokens->momentumMotionOffsets); attr) {
329 attr.Get(&offsetsArray);
330 Eigen::VectorXf offsetVec(offsetsArray.size());
331 for (size_t i = 0; i < offsetsArray.size(); ++i) {
332 offsetVec[i] = offsetsArray[i];
333 }
334 offsetValues = JointParameters(offsetVec);
335 }
336
337 return {std::move(motion), std::move(identity), fps};
338}
339
341 const UsdStageRefPtr& stage,
342 const SdfPath& skelRootPath,
343 float fps,
344 std::span<const std::vector<Marker>> markerSequence) {
345 if (markerSequence.empty()) {
346 return;
347 }
348
349 // Collect unique marker names across all frames
350 std::vector<std::string> markerNames;
351 markerNames.reserve(markerSequence[0].size());
352 std::unordered_set<std::string> seenNames;
353 for (const auto& frameMarkers : markerSequence) {
354 for (const auto& marker : frameMarkers) {
355 if (seenNames.insert(marker.name).second) {
356 markerNames.push_back(marker.name);
357 }
358 }
359 }
360
361 if (markerNames.empty()) {
362 return;
363 }
364
365 // Build per-frame name-to-index maps for O(1) marker lookup
366 std::vector<std::unordered_map<std::string_view, size_t>> frameIndices(markerSequence.size());
367 MT_CHECK(!frameIndices.empty());
368 for (size_t f = 0; f < markerSequence.size(); ++f) {
369 frameIndices[f].reserve(markerSequence[f].size());
370 for (size_t i = 0; i < markerSequence[f].size(); ++i) {
371 frameIndices[f][markerSequence[f][i].name] = i;
372 }
373 }
374
375 // Create Markers scope
376 auto markersPath = skelRootPath.AppendChild(_tokens->Markers);
377 UsdGeomScope::Define(stage, markersPath);
378
379 // Store fps as attribute on the Markers scope
380 auto markersPrim = stage->GetPrimAtPath(markersPath);
381 markersPrim.CreateAttribute(_tokens->momentumMarkersFps, SdfValueTypeNames->Float).Set(fps);
382
383 // Track sanitized names to detect collisions
384 std::unordered_set<std::string> usedSafeNames;
385
386 // Create an Xform prim for each marker
387 for (const auto& name : markerNames) {
388 // Sanitize name for USD path (replace spaces/special chars)
389 std::string safeName = name;
390 for (auto& c : safeName) {
391 if (!std::isalnum(static_cast<unsigned char>(c)) && c != '_') {
392 c = '_';
393 }
394 }
395
396 // Disambiguate if sanitized name collides with an existing one
397 std::string baseName = safeName;
398 int suffix = 1;
399 while (!usedSafeNames.insert(safeName).second) {
400 safeName = baseName + "_" + std::to_string(suffix++);
401 }
402
403 auto markerPath = markersPath.AppendChild(TfToken(safeName));
404 auto xformPrim = UsdGeomXform::Define(stage, markerPath);
405
406 // Store original name as attribute
407 xformPrim.GetPrim()
408 .CreateAttribute(_tokens->momentumMarkerName, SdfValueTypeNames->String)
409 .Set(name);
410
411 auto xformAPI = UsdGeomXformCommonAPI(xformPrim);
412
413 // Create per-marker attributes once, then reuse inside the loop
414 auto occludedAttr = xformPrim.GetPrim().CreateAttribute(
415 _tokens->momentumMarkerOccluded, SdfValueTypeNames->Bool);
416 auto confidenceAttr = xformPrim.GetPrim().CreateAttribute(
417 _tokens->momentumMarkerConfidence, SdfValueTypeNames->Float);
418
419 // Write time-sampled translations, occlusion, and confidence
420 for (size_t frame = 0; frame < markerSequence.size(); ++frame) {
421 const auto timeCode = UsdTimeCode(static_cast<double>(frame));
422
423 // Find this marker in the frame via index map
424 auto it = frameIndices[frame].find(name);
425 if (it != frameIndices[frame].end()) {
426 const auto& marker = markerSequence[frame][it->second];
427 xformAPI.SetTranslate(GfVec3d(marker.pos.x(), marker.pos.y(), marker.pos.z()), timeCode);
428 occludedAttr.Set(marker.occluded, timeCode);
429 confidenceAttr.Set(marker.confidence, timeCode);
430 } else {
431 // Marker not present in this frame — mark as occluded at origin with zero confidence
432 xformAPI.SetTranslate(GfVec3d(0.0, 0.0, 0.0), timeCode);
433 occludedAttr.Set(true, timeCode);
434 confidenceAttr.Set(0.0f, timeCode);
435 }
436 }
437 }
438
439 // Update stage time range
440 const auto endTime = static_cast<double>(markerSequence.size() - 1);
441 if (stage->GetEndTimeCode() < endTime) {
442 stage->SetEndTimeCode(endTime);
443 }
444 if (stage->GetStartTimeCode() > 0.0) {
445 stage->SetStartTimeCode(0.0);
446 }
447 stage->SetTimeCodesPerSecond(static_cast<double>(fps));
448}
449
450MarkerSequence loadMarkerSequenceFromUsd(const UsdStageRefPtr& stage) {
451 MarkerSequence result;
452
453 // Find the Markers scope
454 UsdPrim markersScopePrim;
455 for (const auto& prim : stage->Traverse()) {
456 if (prim.GetName() == _tokens->Markers && prim.IsA<UsdGeomScope>()) {
457 markersScopePrim = prim;
458 break;
459 }
460 }
461
462 if (!markersScopePrim) {
463 return result;
464 }
465
466 // Read fps
467 auto fpsAttr = markersScopePrim.GetAttribute(_tokens->momentumMarkersFps);
468 if (fpsAttr) {
469 fpsAttr.Get(&result.fps);
470 }
471 // TODO: result.name = ...;
472
473 // Collect marker prims
474 struct MarkerPrimInfo {
475 std::string name;
476 UsdGeomXform xform;
477 };
478 std::vector<MarkerPrimInfo> markerPrims;
479
480 for (const auto& child : markersScopePrim.GetChildren()) {
481 if (!child.IsA<UsdGeomXform>()) {
482 continue;
483 }
484
485 std::string markerName;
486 auto nameAttr = child.GetAttribute(_tokens->momentumMarkerName);
487 if (nameAttr) {
488 nameAttr.Get(&markerName);
489 } else {
490 markerName = child.GetName().GetString();
491 }
492
493 markerPrims.push_back({markerName, UsdGeomXform(child)});
494 }
495
496 if (markerPrims.empty()) {
497 return result;
498 }
499
500 // Determine frame count from actual time samples on marker data
501 std::vector<double> timeSamples;
502 auto firstOccludedAttr =
503 markerPrims[0].xform.GetPrim().GetAttribute(_tokens->momentumMarkerOccluded);
504 if (firstOccludedAttr) {
505 firstOccludedAttr.GetTimeSamples(&timeSamples);
506 }
507
508 if (timeSamples.empty()) {
509 return result;
510 }
511
512 const auto numFrames = static_cast<int>(timeSamples.size());
513
514 result.frames.resize(numFrames);
515
516 // Pre-cache per-marker API objects to avoid reconstructing them every frame
517 struct CachedMarkerInfo {
518 std::string name;
519 UsdGeomXformCommonAPI xformAPI;
520 UsdAttribute occludedAttr;
521 UsdAttribute confidenceAttr;
522 };
523 std::vector<CachedMarkerInfo> cachedMarkers;
524 cachedMarkers.reserve(markerPrims.size());
525 for (const auto& [name, xform] : markerPrims) {
526 cachedMarkers.push_back(
527 {name,
528 UsdGeomXformCommonAPI(xform),
529 xform.GetPrim().GetAttribute(_tokens->momentumMarkerOccluded),
530 xform.GetPrim().GetAttribute(_tokens->momentumMarkerConfidence)});
531 }
532
533 for (int frame = 0; frame < numFrames; ++frame) {
534 const auto timeCode = UsdTimeCode(timeSamples[frame]);
535 auto& frameMarkers = result.frames[frame];
536 frameMarkers.reserve(cachedMarkers.size());
537
538 for (const auto& cached : cachedMarkers) {
539 Marker marker;
540 marker.name = cached.name;
541
542 // Read translation
543 GfVec3d translate{};
544 GfVec3f rotation{};
545 GfVec3f scale{};
546 GfVec3f pivot{};
547 UsdGeomXformCommonAPI::RotationOrder rotOrder{};
548 if (cached.xformAPI.GetXformVectors(
549 &translate, &rotation, &scale, &pivot, &rotOrder, timeCode)) {
550 marker.pos = Vector3d(translate[0], translate[1], translate[2]);
551 }
552
553 // Read occlusion
554 if (cached.occludedAttr) {
555 bool occluded = true;
556 cached.occludedAttr.Get(&occluded, timeCode);
557 marker.occluded = occluded;
558 }
559
560 // Read confidence (default 1.0 for backward compatibility)
561 if (cached.confidenceAttr) {
562 float confidence = 1.0f;
563 cached.confidenceAttr.Get(&confidence, timeCode);
564 marker.confidence = confidence;
565 }
566
567 frameMarkers.push_back(std::move(marker));
568 }
569 }
570
571 return result;
572}
573
574} // namespace momentum
#define MT_CHECK(condition,...)
Runtime check macros with two interchangeable backends:
Definition checks.h:36
#define MT_LOGW(...)
Definition log.h:180
Vector3< double > Vector3d
Definition types.h:261
SkeletonT< float > Skeleton
Definition fwd.h:263
std::tuple< std::vector< std::string >, JointParameters > IdentityParameters
A tuple of skeleton joint names and identity parameters.
Definition types.h:179
Vector3< T > quaternionToEuler(const Quaternion< T > &q)
Converts a quaternion to Euler angles using the Extrinsic XYZ convention.
Definition utility.cpp:385
std::tuple< std::vector< std::string >, Eigen::MatrixXf > MotionParameters
A tuple of model parameter names and a matrix of poses across a sequence of frames.
Definition types.h:173
void saveSkeletonStatesToUsd(const UsdStageRefPtr &stage, UsdSkelSkeleton &skelPrim, const Skeleton &skeleton, std::span< const SkeletonState > skeletonStates, float fps)
Save skeleton states as a UsdSkelAnimation on the stage.
JointParametersT< float > JointParameters
Definition types.h:135
void saveMotionToUsd(const UsdPrim &prim, float fps, const MotionParameters &motion, const IdentityParameters &offsets)
Save model-parameter motion as custom attributes on a USD prim.
constexpr size_t kParametersPerJoint
Definition types.h:21
void saveMarkerSequenceToUsd(const UsdStageRefPtr &stage, const SdfPath &skelRootPath, float fps, std::span< const std::vector< Marker > > markerSequence)
Save marker sequence as animated Xform prims under a Markers scope.
std::tuple< MotionParameters, IdentityParameters, float > loadMotionFromUsd(const UsdPrim &prim)
Load model-parameter motion from custom attributes on a USD prim.
MarkerSequence loadMarkerSequenceFromUsd(const UsdStageRefPtr &stage)
Load marker sequence from animated Xform prims.
std::tuple< std::vector< SkeletonState >, std::vector< float > > loadSkeletonStatesFromUsd(const UsdStageRefPtr &stage, const Skeleton &skeleton)
Load skeleton states from a USD stage.
std::vector< std::string > buildHierarchicalPaths(const Skeleton &skeleton)
Build hierarchical joint paths from flat names and parent indices.
static EIGEN_DEVICE_FUNC Derived< Scalar > Zero(::Eigen::Index size)
Definition types.h:92
All frames from a single motion capture sequence for one subject (actor).
Definition marker.h:37
float fps
Frame rate of the capture, in frames per second.
Definition marker.h:45
std::vector< std::vector< Marker > > frames
All marker observations across the sequence. Layout: [numFrames][numMarkers].
Definition marker.h:42
A single motion capture marker observation (position, occlusion, confidence).
Definition marker.h:18
Vector3d pos
The 3D position of the marker, in centimeters.
Definition marker.h:23
bool occluded
True if the marker is occluded in this frame, false if visible.
Definition marker.h:26
float confidence
Trust weight for this observation (e.g.
Definition marker.h:30
std::string name
The name of the marker.
Definition marker.h:20
JointList joints
The list of joints in this skeleton, ordered such that every joint's parent appears earlier in the li...
Definition skeleton.h:25
PXR_NAMESPACE_USING_DIRECTIVE TF_DEFINE_PRIVATE_TOKENS(_tokens,(Animation)(Markers)((momentumMotionFps, "momentum:motion:fps"))((momentumMotionParameterNames, "momentum:motion:parameterNames"))((momentumMotionPoses, "momentum:motion:poses"))((momentumMotionNumFrames, "momentum:motion:numFrames"))((momentumMotionNumParams, "momentum:motion:numParams"))((momentumMotionJointNames, "momentum:motion:jointNames"))((momentumMotionOffsets, "momentum:motion:offsets"))((momentumMarkerName, "momentum:marker:name"))((momentumMarkerOccluded, "momentum:marker:occluded"))((momentumMarkerConfidence, "momentum:marker:confidence"))((momentumMarkersFps, "momentum:markers:fps")))