What is the proper way of applying bone
matrices to vertices so that the actual geometry represents the transformed shape without using GPU?
I have a character model I am applying a skeleton
to that I want to 3D print in different poses, so I want to use the STLExporter
to export a 3D printable file, but it only exports the original geometry.
If I can scene.traverse()
over each SkinnedMesh
and geometry.applyMatrix(???)
with the correct bone matrix in the right order, I should be able to export an STL with the transform applied, right?
var objects = [];
var triangles = 0;
scene.traverse( function ( object ) {
if ( object.isMesh ) {
var geometry = object.geometry;
if ( geometry.isBufferGeometry ) {
geometry = new THREE.Geometry().fromBufferGeometry( geometry );
}
// TODO: Apply skeleton transform
if ( geometry.isGeometry ) {
triangles += geometry.faces.length;
objects.push( {
geometry: geometry,
matrixWorld: object.matrixWorld
} );
}
}
} );
have a look at this pull request: https://github.com/mrdoob/three.js/pull/8953/files
Especially this part:
So to bake the deformations you have to do the following steps:
skinIndices
andskinWeights
Geometry
skinWeights[boneIdx]