diff --git a/Core/Source/bee/Convert/SceneConverter.Mesh.cpp b/Core/Source/bee/Convert/SceneConverter.Mesh.cpp index e5eb725..cbd1f45 100644 --- a/Core/Source/bee/Convert/SceneConverter.Mesh.cpp +++ b/Core/Source/bee/Convert/SceneConverter.Mesh.cpp @@ -593,8 +593,8 @@ SceneConverter::_typeVertices(const FbxMeshVertexLayout &vertex_layout_) { ? channelCount / setCapacity : (channelCount / setCapacity + 1); for (std::remove_const_t iSet = 0; iSet < set; ++iSet) { - const auto setElement = - (iSet == set - 1) ? channelCount % setCapacity : setCapacity; + const auto nSetElements = + (iSet == set - 1) ? (channelCount - iSet * setCapacity) : setCapacity; defaultBulk.addChannel( "JOINTS_" + std::to_string(iSet), // name glTFType, // type @@ -604,7 +604,7 @@ SceneConverter::_typeVertices(const FbxMeshVertexLayout &vertex_layout_) { makeUntypedVertexCopyN< GLTFComponentTypeStorage< fx::gltf::Accessor::ComponentType::UnsignedShort>, - NeutralVertexJointComponent>(setElement) // writer + NeutralVertexJointComponent>(nSetElements) // writer ); defaultBulk.addChannel( "WEIGHTS_" + std::to_string(iSet), // name @@ -615,7 +615,7 @@ SceneConverter::_typeVertices(const FbxMeshVertexLayout &vertex_layout_) { makeUntypedVertexCopyN, NeutralVertexWeightComponent>( - setElement) // writer + nSetElements) // writer ); } } diff --git a/Core/Source/bee/Convert/SceneConverter.Skin.cpp b/Core/Source/bee/Convert/SceneConverter.Skin.cpp index d413a18..caf3945 100644 --- a/Core/Source/bee/Convert/SceneConverter.Skin.cpp +++ b/Core/Source/bee/Convert/SceneConverter.Skin.cpp @@ -211,6 +211,11 @@ SceneConverter::_extractSkinData(const fbxsdk::FbxMesh &fbx_mesh_) { for (std::remove_const_t iControlPointIndex = 0; iControlPointIndex < nControlPointIndices; ++iControlPointIndex) { + const auto weight = static_cast( + controlPointWeights[iControlPointIndex]); + if (!weight) { + continue; + } const auto controlPointIndex = controlPointIndices[iControlPointIndex]; auto &nChannels = channelsCount[controlPointIndex]; assert(nChannels <= skinData.channels.size()); @@ -219,8 +224,7 @@ SceneConverter::_extractSkinData(const fbxsdk::FbxMesh &fbx_mesh_) { } auto &[joints, weights] = skinData.channels[nChannels]; joints[controlPointIndex] = jointId; - weights[controlPointIndex] = static_cast( - controlPointWeights[iControlPointIndex]); + weights[controlPointIndex] = weight; ++nChannels; } } @@ -255,6 +259,7 @@ SceneConverter::_extractSkinData(const fbxsdk::FbxMesh &fbx_mesh_) { std::uint32_t SceneConverter::_createGLTFSkin(const NodeMeshesSkinData &skin_data_) { fx::gltf::Skin glTFSkin; + glTFSkin.name = skin_data_.name; glTFSkin.joints.resize(skin_data_.bones.size()); std::transform( skin_data_.bones.begin(), skin_data_.bones.end(), glTFSkin.joints.begin(),