<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with bone weight in FBX Forum</title>
    <link>https://forums.autodesk.com/t5/fbx-forum/problem-with-bone-weight/m-p/6379746#M2062</link>
    <description>&lt;P&gt;Turns out that the SDK does not&amp;nbsp;always respect the specified rotation order ... I changed my application to use quaternions and converted the quaternions in the SDK (as described &lt;A title="Quaternion to Euler" href="https://forums.autodesk.com/t5/fbx-sdk/quaternion-to-euler-angles/m-p/4018459#M480" target="_blank"&gt;HERE&lt;/A&gt;), which seems like the most secure option. The code for the bone weights in my original post did not change.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2016 07:39:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-06-13T07:39:52Z</dc:date>
    <item>
      <title>Problem with bone weight</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/problem-with-bone-weight/m-p/6375458#M2061</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to export a character using the FBX-SDK. I can export the mesh and the bones correctly, but adding weights to the mesh is not working correctly. The file without weights looks like this (Left: Blender, Right: FbxReview):&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/246544i4B5ADE690C298AD3/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Blender without weight" title="Blender without weight" width="231" height="433" /&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/246545i75848328D920E37B/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="FbxReview without weight" title="FbxReview without weight" width="244" height="428" /&gt;&lt;/P&gt;&lt;P&gt;The file with weights looks like this:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/246546iA94023D4CD8B28C0/image-size/medium?v=v2&amp;amp;px=-1" border="0" alt="Blender with weight" title="Blender with weight" /&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/246547i881037261C192D0A/image-size/medium?v=v2&amp;amp;px=-1" border="0" alt="FbxReview with weight" title="FbxReview with weight" /&gt;&lt;/P&gt;&lt;P&gt;The weights of the vertices are actually correct (if I move a bone the corresponding part of the mesh moves), but the position is off. I suspect it has something to do with SetTransformMatrix or SetTransformLinkMatrix?&amp;nbsp;I also had some problems with the rotation order (had to set it to&amp;nbsp;ZXY) and inherit types (had to set it to&amp;nbsp;RSrs) before, but I don't think that is relevant here since the matrices are set directly (but maybe I am wrong?).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code for adding the weights looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if (obj-&amp;gt;hasWeights()) {
	FbxAMatrix meshMatrix = meshNode-&amp;gt;EvaluateGlobalTransform();
	FbxSkin* skin = obj-&amp;gt;addSkin(manager);
	FbxPose* bindPose = FbxPose::Create(manager, "BindPose");
	bindPose-&amp;gt;SetIsBindPose(true);
	std::map&amp;lt;Bone*, std::list&amp;lt;struct VertexWeight&amp;gt;&amp;gt; weights = obj-&amp;gt;getVertexWeights();
	for (std::pair&amp;lt;Bone*, std::list&amp;lt;struct VertexWeight&amp;gt;&amp;gt; pair : weights) {
		Bone* curBone = pair.first;
		FbxCluster* cluster = curBone-&amp;gt;createCluster(manager);
		for (VertexWeight weight : pair.second) {
			cluster-&amp;gt;AddControlPointIndex(weight.vertexIndex, weight.weight);
		}
		FbxNode* boneNode = curBone-&amp;gt;getNode();
		FbxAMatrix boneMatrix = boneNode-&amp;gt;EvaluateGlobalTransform();
		cluster-&amp;gt;SetTransformMatrix(meshMatrix);
		cluster-&amp;gt;SetTransformLinkMatrix(boneMatrix);
		skin-&amp;gt;AddCluster(cluster);
		FbxNode* curNode = boneNode;
		while (curNode!=nullptr) {
			if(bindPose-&amp;gt;Find(curNode)==-1) {
				bindPose-&amp;gt;Add(curNode, curNode-&amp;gt;EvaluateGlobalTransform());
			}
			curNode = curNode-&amp;gt;GetParent();
		}

	}
	
	scene-&amp;gt;AddPose(bindPose);
}&lt;/PRE&gt;&lt;PRE&gt;FbxSkin * UObject::addSkin(FbxManager * manager)
{
	this-&amp;gt;skin = FbxSkin::Create(manager, this-&amp;gt;name.c_str());
	((FbxGeometry*)this-&amp;gt;node-&amp;gt;GetNodeAttribute())-&amp;gt;AddDeformer(this-&amp;gt;skin);
	return this-&amp;gt;skin;
}&lt;/PRE&gt;&lt;PRE&gt;FbxCluster * Bone::createCluster(FbxManager * manager)
{
	this-&amp;gt;cluster = FbxCluster::Create(manager, this-&amp;gt;name.c_str());
	this-&amp;gt;cluster-&amp;gt;SetLink(this-&amp;gt;node);
	this-&amp;gt;cluster-&amp;gt;SetLinkMode(FbxCluster::ELinkMode::eNormalize);
	return this-&amp;gt;cluster;
}&lt;/PRE&gt;&lt;P&gt;Any ideas or hints are much&amp;nbsp;appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 16:56:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/problem-with-bone-weight/m-p/6375458#M2061</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-09T16:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with bone weight</title>
      <link>https://forums.autodesk.com/t5/fbx-forum/problem-with-bone-weight/m-p/6379746#M2062</link>
      <description>&lt;P&gt;Turns out that the SDK does not&amp;nbsp;always respect the specified rotation order ... I changed my application to use quaternions and converted the quaternions in the SDK (as described &lt;A title="Quaternion to Euler" href="https://forums.autodesk.com/t5/fbx-sdk/quaternion-to-euler-angles/m-p/4018459#M480" target="_blank"&gt;HERE&lt;/A&gt;), which seems like the most secure option. The code for the bone weights in my original post did not change.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 07:39:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fbx-forum/problem-with-bone-weight/m-p/6379746#M2062</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-13T07:39:52Z</dc:date>
    </item>
  </channel>
</rss>

