Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
linear_skinning.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
15#include "momentum/math/mesh.h"
16
17#include <dispenso/parallel_for.h>
18#include <gsl/narrow>
19
20namespace momentum {
21
22template <typename T>
23std::vector<Eigen::Matrix4<T>> computeSkinningTransforms(
24 typename DeduceSpanType<const JointStateT<T>>::type jointState,
25 const TransformationListT<T>& inverseBindPose) {
27 jointState.size() == inverseBindPose.size(),
28 "{} vs {}",
29 jointState.size(),
30 inverseBindPose.size());
31
32 std::vector<Eigen::Matrix4<T>> transforms(inverseBindPose.size());
33 for (size_t i = 0; i < inverseBindPose.size(); i++) {
34 transforms[i].noalias() = (jointState[i].transform * inverseBindPose[i]).matrix();
35 }
36 return transforms;
37}
38
39template <typename T>
40std::vector<Vector3<T>> applySSD(
41 const SkinWeights& skin,
42 typename DeduceSpanType<const Vector3<T>>::type points,
43 typename DeduceSpanType<const Eigen::Matrix4<T>>::type skinningTransforms) {
45
47 skin.index.rows() == static_cast<int>(points.size()),
48 "{} vs {}",
49 skin.index.rows(),
50 points.size());
52 skin.weight.rows() == static_cast<int>(points.size()),
53 "{} vs {}",
54 skin.weight.rows(),
55 points.size());
56
57 std::vector<Vector3<T>> result(points.size(), Vector3<T>::Zero());
58
59 dispenso::ParForOptions options;
60 options.minItemsPerChunk = 1024u;
61
62 dispenso::parallel_for(
63 dispenso::makeChunkedRange(0, skin.index.rows(), dispenso::ParForChunking::kAdaptive),
64 [&](const size_t rangeBegin, const size_t rangeEnd) {
65 for (size_t i = rangeBegin; i != rangeEnd; i++) {
66 const Vector3<T>& pos = points[i];
67 auto& output = result[i];
68 output.setZero();
69
70 // Unused influence slots are zero-filled (see `SkinWeights`); the first zero
71 // weight terminates the active influences for this vertex.
72 // TODO: This break assumes used slots are packed contiguously at the front
73 // (no zero gaps before non-zero entries). `SkinWeights::set` enforces this
74 // for ragged inputs, but other loaders may not — consider documenting the
75 // invariant on `SkinWeights` or replacing the break with a continue.
76 for (size_t j = 0; j < kMaxSkinJoints; j++) {
77 const auto& weight = skin.weight(i, j);
78 if (weight == 0.0f) {
79 break;
80 }
81
82 MT_CHECK(
83 skin.index(i, j) < skinningTransforms.size(),
84 "skin.index({}, {}): {} vs {}",
85 i,
86 j,
87 skin.index(i, j),
88 skinningTransforms.size());
89 const auto& transformation = skinningTransforms[skin.index(i, j)];
90
91 // Equivalent to: output += (transformation * (pos, 1)) * weight,
92 // expanded to avoid the homogeneous extension of `pos`.
93 Eigen::Vector3<T> temp = transformation.template topRightCorner<3, 1>();
94 temp.noalias() += transformation.template topLeftCorner<3, 3>() * pos;
95 output.noalias() += temp * weight;
96 }
97 }
98 },
99 options);
100
101 return result;
102}
103
104template <typename T>
105std::vector<Vector3<T>> applySSD(
106 const TransformationListT<T>& inverseBindPose,
107 const SkinWeights& skin,
108 typename DeduceSpanType<const Vector3<T>>::type points,
109 typename DeduceSpanType<const JointStateT<T>>::type jointState) {
110 const auto skinningTransforms = computeSkinningTransforms<T>(jointState, inverseBindPose);
111 return applySSD<T>(skin, points, skinningTransforms);
112}
113
114template <typename T>
115std::vector<Vector3<T>> applySSD(
116 const TransformationListT<T>& inverseBindPose,
117 const SkinWeights& skin,
118 typename DeduceSpanType<const Vector3<T>>::type points,
119 const SkeletonStateT<T>& state) {
120 return applySSD<T>(inverseBindPose, skin, points, state.jointState);
121}
122
123template <typename T>
124std::vector<Vector3<T>> applySSD(
125 const TransformationListT<T>& inverseBindPose,
126 const SkinWeights& skin,
127 typename DeduceSpanType<const Vector3<T>>::type points,
128 const TransformationListT<T>& worldTransforms) {
129 MT_CHECK(
130 worldTransforms.size() == inverseBindPose.size(),
131 "{} vs {}",
132 worldTransforms.size(),
133 inverseBindPose.size());
134
135 std::vector<Eigen::Matrix4<T>> skinningTransforms(inverseBindPose.size());
136 for (size_t i = 0; i < inverseBindPose.size(); i++) {
137 skinningTransforms[i].noalias() = (worldTransforms[i] * inverseBindPose[i]).matrix();
138 }
139 return applySSD<T>(skin, points, skinningTransforms);
140}
141
142template <typename T>
143std::vector<Vector3<T>> applySSD(
144 const TransformationListT<T>& inverseBindPose,
145 const SkinWeights& skin,
146 typename DeduceSpanType<const Vector3<T>>::type points,
147 typename DeduceSpanType<const TransformT<T>>::type worldTransforms) {
148 MT_CHECK(
149 worldTransforms.size() == inverseBindPose.size(),
150 "{} vs {}",
151 worldTransforms.size(),
152 inverseBindPose.size());
153
154 std::vector<Eigen::Matrix4<T>> skinningTransforms(inverseBindPose.size());
155 for (size_t i = 0; i < inverseBindPose.size(); i++) {
156 skinningTransforms[i].noalias() = (worldTransforms[i] * inverseBindPose[i]).matrix();
157 }
158 return applySSD<T>(skin, points, skinningTransforms);
159}
160
161template <typename T>
163 const SkinWeights& skin,
164 const MeshT<T>& mesh,
165 typename DeduceSpanType<const Eigen::Matrix4<T>>::type skinningTransforms,
166 MeshT<T>& outputMesh) {
168
169 MT_CHECK(
170 skin.index.rows() == static_cast<int>(mesh.vertices.size()),
171 "{} vs {}",
172 skin.index.rows(),
173 mesh.vertices.size());
174 MT_CHECK(
175 skin.weight.rows() == static_cast<int>(mesh.vertices.size()),
176 "{} vs {}",
177 skin.weight.rows(),
178 mesh.vertices.size());
179 MT_CHECK(
180 outputMesh.vertices.size() == mesh.vertices.size(),
181 "{} vs {}",
182 outputMesh.vertices.size(),
183 mesh.vertices.size());
184 MT_CHECK(
185 outputMesh.normals.size() == mesh.normals.size(),
186 "{} vs {}",
187 outputMesh.normals.size(),
188 mesh.normals.size());
189 MT_CHECK(
190 outputMesh.faces.size() == mesh.faces.size(),
191 "{} vs {}",
192 outputMesh.faces.size(),
193 mesh.faces.size());
194
195 dispenso::ParForOptions options;
196 options.minItemsPerChunk = 1024u;
197
198 dispenso::parallel_for(
199 dispenso::makeChunkedRange(0, skin.index.rows(), dispenso::ParForChunking::kAdaptive),
200 [&](const size_t rangeBegin, const size_t rangeEnd) {
201 for (size_t i = rangeBegin; i != rangeEnd; i++) {
202 const Vector3<T>& pos = mesh.vertices[i];
203 const Vector3<T>& nml = mesh.normals[i];
204 auto& outputp = outputMesh.vertices[i];
205 outputp.setZero();
206 auto& outputn = outputMesh.normals[i];
207 outputn.setZero();
208
209 // Unused influence slots are zero-filled (see `SkinWeights`); the first zero
210 // weight terminates the active influences for this vertex.
211 // TODO: This break assumes used slots are packed contiguously at the front
212 // (no zero gaps before non-zero entries). `SkinWeights::set` enforces this
213 // for ragged inputs, but other loaders may not — consider documenting the
214 // invariant on `SkinWeights` or replacing the break with a continue.
215 for (size_t j = 0; j < kMaxSkinJoints; j++) {
216 const auto& weight = skin.weight(i, j);
217 if (weight == 0.0f) {
218 break;
219 }
220
221 MT_CHECK(
222 skin.index(i, j) < skinningTransforms.size(),
223 "skin.index({}, {}): {} vs {}",
224 i,
225 j,
226 skin.index(i, j),
227 skinningTransforms.size());
228 const auto& transformation = skinningTransforms[skin.index(i, j)];
229
230 // Equivalent to: outputp += (transformation * (pos, 1)) * weight,
231 // expanded to avoid the homogeneous extension of `pos`.
232 const auto& topLeft = transformation.template topLeftCorner<3, 3>();
233 Eigen::Vector3<T> temp = transformation.template topRightCorner<3, 1>();
234 temp.noalias() += topLeft * pos;
235 outputp.noalias() += temp * weight;
236
237 // Normals transform with the rotation/scale block only (no translation).
238 // TODO: This is the inverse-transpose only for rigid transforms; for
239 // non-uniform scale the normal direction will be incorrect.
240 outputn.noalias() += topLeft * nml * weight;
241 }
242 outputn.normalize();
243 }
244 },
245 options);
246}
247
248template <typename T>
250 const TransformationListT<T>& inverseBindPose,
251 const SkinWeights& skin,
252 const MeshT<T>& mesh,
253 typename DeduceSpanType<const JointStateT<T>>::type jointState,
254 MeshT<T>& outputMesh) {
255 const auto skinningTransforms = computeSkinningTransforms(jointState, inverseBindPose);
256 applySSD(skin, mesh, skinningTransforms, outputMesh);
257}
258
259template <typename T>
261 const TransformationListT<T>& inverseBindPose,
262 const SkinWeights& skin,
263 const MeshT<T>& mesh,
264 const SkeletonStateT<T>& state,
265 MeshT<T>& outputMesh) {
266 applySSD(inverseBindPose, skin, mesh, state.jointState, outputMesh);
267}
268
269template <typename T>
271 const TransformationListT<T>& inverseBindPose,
272 const SkinWeights& skin,
273 const MeshT<T>& mesh,
274 const TransformationListT<T>& worldTransforms,
275 MeshT<T>& outputMesh) {
276 MT_CHECK(
277 worldTransforms.size() == inverseBindPose.size(),
278 "{} vs {}",
279 worldTransforms.size(),
280 inverseBindPose.size());
281
282 std::vector<Eigen::Matrix4<T>> skinningTransforms(inverseBindPose.size());
283 for (size_t i = 0; i < inverseBindPose.size(); i++) {
284 skinningTransforms[i].noalias() = (worldTransforms[i] * inverseBindPose[i]).matrix();
285 }
286 applySSD(skin, mesh, skinningTransforms, outputMesh);
287}
288
289template <typename T>
291 const TransformationListT<T>& inverseBindPose,
292 const SkinWeights& skin,
293 const MeshT<T>& mesh,
294 typename DeduceSpanType<const TransformT<T>>::type worldTransforms,
295 MeshT<T>& outputMesh) {
296 MT_CHECK(
297 worldTransforms.size() == inverseBindPose.size(),
298 "{} vs {}",
299 worldTransforms.size(),
300 inverseBindPose.size());
301
302 std::vector<Eigen::Matrix4<T>> skinningTransforms(inverseBindPose.size());
303 for (size_t i = 0; i < inverseBindPose.size(); i++) {
304 skinningTransforms[i].noalias() = (worldTransforms[i] * inverseBindPose[i]).matrix();
305 }
306 applySSD(skin, mesh, skinningTransforms, outputMesh);
307}
308
310 const TransformationList& inverseBindPose,
311 const SkinWeights& skin,
312 const SkeletonState& state,
313 const size_t index) {
314 MT_CHECK(
315 state.jointState.size() == inverseBindPose.size(),
316 "{} vs {}",
317 state.jointState.size(),
318 inverseBindPose.size());
319 MT_CHECK(
320 gsl::narrow_cast<Eigen::Index>(index) < skin.index.rows(),
321 "{} vs {}",
322 index,
323 skin.index.rows());
324
325 Affine3f transform;
326 transform.matrix().setZero();
327
328 for (size_t j = 0; j < kMaxSkinJoints; j++) {
329 const auto& weight = skin.weight(index, j);
330 if (weight == 0.0f) {
331 break;
332 }
333
334 auto jointIndex = skin.index(index, j);
335 MT_CHECK(
336 jointIndex < inverseBindPose.size(),
337 "skin.index({}, {}): {} vs {}",
338 index,
339 j,
340 jointIndex,
341 inverseBindPose.size());
342 const auto transformation =
343 state.jointState[jointIndex].transform * inverseBindPose[jointIndex];
344
345 transform.matrix().noalias() += transformation.matrix() * weight;
346 }
347
348 return transform.inverse();
349}
350
352 const TransformationList& inverseBindPose,
353 const SkinWeights& skin,
355 const SkeletonState& state,
356 Mesh& mesh) {
357 MT_CHECK(points.size() == mesh.vertices.size(), "{} vs {}", points.size(), mesh.vertices.size());
358
359 mesh.vertices = applyInverseSSD(inverseBindPose, skin, points, state);
360}
361
362std::vector<Vector3f> applyInverseSSD(
363 const TransformationList& inverseBindPose,
364 const SkinWeights& skin,
366 const SkeletonState& state) {
367 MT_CHECK(
368 state.jointState.size() == inverseBindPose.size(),
369 "{} vs {}",
370 state.jointState.size(),
371 inverseBindPose.size());
372 MT_CHECK(
373 skin.index.rows() == static_cast<int>(points.size()),
374 "{} vs {}",
375 skin.index.rows(),
376 points.size());
377 MT_CHECK(
378 skin.weight.rows() == static_cast<int>(points.size()),
379 "{} vs {}",
380 skin.weight.rows(),
381 points.size());
382
383 std::vector<Vector3f> res(points.size());
384
385 TransformationList transformations(state.jointState.size());
386 for (size_t i = 0; i < transformations.size(); i++) {
387 transformations[i] = state.jointState[i].transform * inverseBindPose[i];
388 }
389
390 for (int i = 0; i != (int)skin.index.rows(); i++) {
391 const Vector3f& pos = points[i];
392
393 Affine3f transform;
394 transform.matrix().setZero();
395
396 for (size_t j = 0; j < kMaxSkinJoints; j++) {
397 const auto& weight = skin.weight(i, j);
398 if (weight == 0.0f) {
399 break;
400 }
401
402 MT_CHECK(
403 skin.index(i, j) < transformations.size(),
404 "skin.index({}, {}): {} vs {}",
405 i,
406 j,
407 skin.index(i, j),
408 transformations.size());
409 const auto& transformation = transformations[skin.index(i, j)];
410
411 transform.matrix().noalias() += transformation.matrix() * weight;
412 }
413
414 res[i].noalias() = transform.inverse() * pos;
415 }
416
417 return res;
418}
419
420template std::vector<Eigen::Matrix4f> computeSkinningTransforms<float>(
421 momentum::span<const JointStateT<float>> jointState,
422 const TransformationListT<float>& inverseBindPose);
423template std::vector<Eigen::Matrix4d> computeSkinningTransforms<double>(
424 momentum::span<const JointStateT<double>> jointState,
425 const TransformationListT<double>& inverseBindPose);
426
427template std::vector<Vector3f> applySSD<float>(
428 const SkinWeights& skin,
430 momentum::span<const Eigen::Matrix4f> skinningTransforms);
431template std::vector<Vector3d> applySSD<double>(
432 const SkinWeights& skin,
434 momentum::span<const Eigen::Matrix4d> skinningTransforms);
435
436template std::vector<Vector3f> applySSD<float>(
437 const TransformationListT<float>& inverseBindPose,
438 const SkinWeights& skin,
440 momentum::span<const JointStateT<float>> jointState);
441template std::vector<Vector3d> applySSD<double>(
442 const TransformationListT<double>& inverseBindPose,
443 const SkinWeights& skin,
445 momentum::span<const JointStateT<double>> jointState);
446
447template std::vector<Vector3f> applySSD<float>(
448 const TransformationListT<float>& inverseBindPose,
449 const SkinWeights& skin,
451 const SkeletonStateT<float>& state);
452template std::vector<Vector3d> applySSD<double>(
453 const TransformationListT<double>& inverseBindPose,
454 const SkinWeights& skin,
456 const SkeletonStateT<double>& state);
457
458template std::vector<Vector3f> applySSD<float>(
459 const TransformationListT<float>& inverseBindPose,
460 const SkinWeights& skin,
462 const TransformationListT<float>& worldTransforms);
463template std::vector<Vector3d> applySSD<double>(
464 const TransformationListT<double>& inverseBindPose,
465 const SkinWeights& skin,
467 const TransformationListT<double>& worldTransforms);
468
469template std::vector<Vector3f> applySSD<float>(
470 const TransformationListT<float>& inverseBindPose,
471 const SkinWeights& skin,
473 momentum::span<const TransformT<float>> worldTransforms);
474template std::vector<Vector3d> applySSD<double>(
475 const TransformationListT<double>& inverseBindPose,
476 const SkinWeights& skin,
478 momentum::span<const TransformT<double>> worldTransforms);
479
480template void applySSD<float>(
481 const SkinWeights& skin,
482 const MeshT<float>& mesh,
483 momentum::span<const Eigen::Matrix4f> skinningTransforms,
484 MeshT<float>& outputMesh);
485template void applySSD<double>(
486 const SkinWeights& skin,
487 const MeshT<double>& mesh,
488 momentum::span<const Eigen::Matrix4d> skinningTransforms,
489 MeshT<double>& outputMesh);
490
491template void applySSD<float>(
492 const TransformationListT<float>& inverseBindPose,
493 const SkinWeights& skin,
494 const MeshT<float>& mesh,
495 momentum::span<const JointStateT<float>> jointState,
496 MeshT<float>& outputMesh);
497template void applySSD<double>(
498 const TransformationListT<double>& inverseBindPose,
499 const SkinWeights& skin,
500 const MeshT<double>& mesh,
501 momentum::span<const JointStateT<double>> jointState,
502 MeshT<double>& outputMesh);
503
504template void applySSD<float>(
505 const TransformationListT<float>& inverseBindPose,
506 const SkinWeights& skin,
507 const MeshT<float>& mesh,
508 const SkeletonStateT<float>& state,
509 MeshT<float>& outputMesh);
510template void applySSD<double>(
511 const TransformationListT<double>& inverseBindPose,
512 const SkinWeights& skin,
513 const MeshT<double>& mesh,
514 const SkeletonStateT<double>& state,
515 MeshT<double>& outputMesh);
516
517template void applySSD<float>(
518 const TransformationListT<float>& inverseBindPose,
519 const SkinWeights& skin,
520 const MeshT<float>& mesh,
521 const TransformationListT<float>& worldTransforms,
522 MeshT<float>& outputMesh);
523template void applySSD<double>(
524 const TransformationListT<double>& inverseBindPose,
525 const SkinWeights& skin,
526 const MeshT<double>& mesh,
527 const TransformationListT<double>& worldTransforms,
528 MeshT<double>& outputMesh);
529
530template void applySSD<float>(
531 const TransformationListT<float>& inverseBindPose,
532 const SkinWeights& skin,
533 const MeshT<float>& mesh,
534 momentum::span<const TransformT<float>> worldTransforms,
535 MeshT<float>& outputMesh);
536template void applySSD<double>(
537 const TransformationListT<double>& inverseBindPose,
538 const SkinWeights& skin,
539 const MeshT<double>& mesh,
540 momentum::span<const TransformT<double>> worldTransforms,
541 MeshT<double>& outputMesh);
542
543template <typename T>
545 const SkinnedLocator& locator,
546 const Vector3<T>& restPosition,
547 const TransformationList& inverseBindPose,
548 const SkeletonStateT<T>& state) {
549 Vector3<T> worldPos = Vector3<T>::Zero();
550 T weightSum = 0;
551 for (int k = 0; k < locator.skinWeights.size(); ++k) {
552 const auto weight = static_cast<T>(locator.skinWeights[k]);
553 if (weight == 0) {
554 break;
555 }
556 const auto boneIndex = locator.parents[k];
558 boneIndex >= state.jointState.size() || boneIndex >= inverseBindPose.size(),
559 "Bone index {} exceeds jointState size {} or inverseBindPose size {}",
560 boneIndex,
561 state.jointState.size(),
562 inverseBindPose.size());
563 const auto& jointState = state.jointState[boneIndex];
564
565 worldPos +=
566 weight * (jointState.transform * (inverseBindPose[boneIndex].cast<T>() * restPosition));
567 weightSum += weight;
568 }
569
570 return worldPos / weightSum;
571}
572
574 const SkinnedLocator& locator,
575 const Vector3<float>& restPosition,
576 const TransformationList& inverseBindPose,
577 const SkeletonStateT<float>& state);
579 const SkinnedLocator& locator,
580 const Vector3<double>& restPosition,
581 const TransformationList& inverseBindPose,
582 const SkeletonStateT<double>& state);
583
584template <typename T>
586 const SkinnedLocator& locator,
587 const TransformationList& inverseBindPose,
588 const SkeletonStateT<T>& state) {
589 const Vector3<T> restPosition = locator.position.template cast<T>();
590 return getSkinnedLocatorPosition(locator, restPosition, inverseBindPose, state);
591}
592
594 const SkinnedLocator& locator,
595 const TransformationList& inverseBindPose,
596 const SkeletonStateT<float>& state);
598 const SkinnedLocator& locator,
599 const TransformationList& inverseBindPose,
600 const SkeletonStateT<double>& state);
601
602} // namespace momentum
#define MT_CHECK(condition,...)
Runtime check macros with two interchangeable backends:
Definition checks.h:36
#define MT_THROW_IF(Condition,...)
Conditionally throws a std::runtime_error with a formatted message if the condition is true.
Definition exception.h:55
Functions for linear blend skinning (Skeletal Subspace Deformation).
Affine3< float > Affine3f
Definition types.h:405
Affine3f getInverseSSDTransformation(const TransformationList &inverseBindPose, const SkinWeights &skin, const SkeletonState &state, const size_t index)
Computes the inverse SSD transformation for a specific vertex.
Vector3< T > getSkinnedLocatorPosition(const SkinnedLocator &locator, const Vector3< T > &restPosition, const TransformationList &inverseBindPose, const SkeletonStateT< T > &state)
Computes the world position of a skinned locator using linear blend skinning.
std::vector< Affine3f > TransformationList
One affine transform per joint, indexed by joint id.
Definition types.h:410
MeshT< float > Mesh
Definition fwd.h:20
SkeletonStateT< float > SkeletonState
Definition fwd.h:282
void applyInverseSSD(const TransformationList &inverseBindPose, const SkinWeights &skin, momentum::span< const Vector3f > points, const SkeletonState &state, Mesh &mesh)
Applies inverse SSD to points, storing results in a mesh.
std::vector< Vector3< T > > applySSD(const SkinWeights &skin, typename DeduceSpanType< const Vector3< T > >::type points, typename DeduceSpanType< const Eigen::Matrix4< T > >::type skinningTransforms)
Applies forward SSD (linear blend skinning) to points using precomputed skinning transforms.
gsl::span< T > span
Span type alias using gsl::span (C++17 fallback).
Definition span_compat.h:54
Vector< T, 3 > Vector3
Definition types.h:236
Vector3< float > Vector3f
Definition types.h:251
std::vector< Eigen::Matrix4< T > > computeSkinningTransforms(typename DeduceSpanType< const JointStateT< T > >::type jointState, const TransformationListT< T > &inverseBindPose)
Computes the skinning transforms from joint states and inverse bind poses.
std::vector< Affine3< T > > TransformationListT
Scalar-templated counterpart of TransformationList.
Definition types.h:413
constexpr uint32_t kMaxSkinJoints
Maximum number of joints that can influence a single vertex.
decltype(auto) cast(const ContainerType< ObjectType > &originalContainer)
Casts the scalar type of objects in a container that support the cast<>() method.
Definition types.h:466
Profiling macros that dispatch to one of three backends, selected at compile time:
#define MT_PROFILE_FUNCTION()
Definition profile.h:110
A utility struct that facilitates the deduction of a momentum::span type from a given type.
Definition types.h:453
Represents the state of a joint with local and global transformations.
Definition joint_state.h:50
A generic mesh representation with support for vertices, faces, lines, and texture coordinates.
Definition mesh.h:20
std::vector< Eigen::Vector3< T > > vertices
List of mesh vertices in 3D space.
Definition mesh.h:22
std::vector< Eigen::Vector3< T > > normals
List of vertex normals (same size as vertices when computed).
Definition mesh.h:25
std::vector< Eigen::Vector3i > faces
List of triangular faces defined by vertex indices.
Definition mesh.h:28
Represents the complete state of a skeleton.
JointStateListT< T > jointState
Computed joint states for all joints in the skeleton.
Linear blend skinning weights for a character mesh: per-vertex joint indices and influence weights.
WeightMatrix weight
Joint influence weights per vertex.
IndexMatrix index
Joint indices influencing each vertex.
A locator attached to multiple joints, with its runtime position determined by blending the skinning ...
Eigen::Matrix< uint32_t, kMaxSkinJoints, 1 > parents
Indices of the parent joints used for skinning.
Eigen::Matrix< float, kMaxSkinJoints, 1 > skinWeights
Skinning weight for each entry in parents. Typically sums to 1.0.
Vector3f position
Position in the character's rest-pose coordinate frame.
Lightweight transform with separate rotation, translation, and uniform scaling.
Definition transform.h:36