<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi, last week a I wrote <a moz-do-not-send="true"
href="http://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_TODO_2014_07"
      target="_blank">http://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_TODO_2014_07</a>,<br>
    a 'current status' of remaining FBX TODOs, as far as I can see them
    currently. These are rather complex topics.<br>
    <br>
    We then exchanged a bit with Jens and Ton about it, but it’s better
    to keep tech/design discussion public,<br>
    so here is a summary of it (hope I did not forget anything!).<br>
    <br>
    Jens spent some time to generate test files with Maya: <a
      moz-do-not-send="true"
      href="http://www.restemeier.org/Maya2013.zip">http://www.restemeier.org/Maya2013.zip</a>:<br>
    « These are generated with Maya 2013 and are written out to FBX
    2013.<br>
    Maya has the advantage that it can operate in "Y-Up" mode and "Z-Up"
    mode, and the FBX exporter<br>
    <div>can export to either as well. This way I have valid reference
      material to check the exporter and importer against.<br>
      Some of these files cause crashes or asserts in Blender that I'll
      have to look into as well. »<br>
    </div>
    <div><br>
      (double quotes are from wiki page, simple quotes are Jens'
      answers).<br>
      <br>
    </div>
    ==Bake transform==<br>
    <blockquote type="cite">
      <blockquote type="cite">
        <blockquote style="margin:0px 0px 0px
          40px;border:none;padding:0px">
          <div>
            <h2
              style="font-size:13pt;overflow:hidden;margin:0px;padding-top:0.5em;padding-bottom:0.17em;color:rgb(51,51,51);font-family:'Lucida
              Grande','Lucida Sans Unicode','Lucida
Sans',Lucida,Verdana,sans-serif;line-height:17.399999618530273px;background-color:rgb(238,238,238)">Finish
              'Bake transform' feature</h2>
          </div>
          <div>
            <div style="color: rgb(51, 51, 51); font-family: 'Lucida
              Grande', 'Lucida Sans Unicode', 'Lucida Sans', Lucida,
              Verdana, sans-serif; font-size: 12px; line-height: 1.5em;
              margin-top: 0.4em; margin-right: 0px; margin-bottom:
              0.5em; margin-left: 0px; text-align: justify;
              background-color: rgb(238, 238, 238); ">
              This feature came from user request &amp; patch. Issue is,
              when you export to another global orientation than Blender
              native one (Z up, Y forward), we apply some rotation to
              all objects, so that they still look in the right
              orientation in the target app. But this means objects in
              this target app will have some extra rotation (e.g. 90°
              around X axis…).</div>
          </div>
          <div>
            <div style="color: rgb(51, 51, 51); font-family: 'Lucida
              Grande', 'Lucida Sans Unicode', 'Lucida Sans', Lucida,
              Verdana, sans-serif; font-size: 12px; line-height: 1.5em;
              margin-top: 0.4em; margin-right: 0px; margin-bottom:
              0.5em; margin-left: 0px; text-align: justify;
              background-color: rgb(238, 238, 238); ">
              To fix that, we added an option to 'bake' transformations
              into object's data itself, rather than object rotation.
              Currently, this is only working for meshes (and other
              geometries we convert to meshes during export).</div>
          </div>
          <div>
            <div style="color: rgb(51, 51, 51); font-family: 'Lucida
              Grande', 'Lucida Sans Unicode', 'Lucida Sans', Lucida,
              Verdana, sans-serif; font-size: 12px; line-height: 1.5em;
              margin-top: 0.4em; margin-right: 0px; margin-bottom:
              0.5em; margin-left: 0px; text-align: justify;
              background-color: rgb(238, 238, 238); ">
              We are already working on a patch that extends this to
              empties and armatures, and if armatures are possible,
              should be as well for bones, maybe? Quite a complex task,
              though.</div>
          </div>
        </blockquote>
      </blockquote>
    </blockquote>
    <blockquote type="cite">
      <div>From my position the export was working how I wanted it to,
        but Bastien pointed out some performance problems and problems
        in the handling of bones. You will need similar code on the
        importer side, so that a scene that was exported with baked
        transforms or that was modelled with Y-up comes back correctly
        into Blender.</div>
    </blockquote>
    Ton also raised a valid point here - this feature should be
    available for all addons, in the end.<br>
    <br>
    Would be a good starting point for an "io helper' py module, idea we
    already had with Campbell<br>
    for other topics as well (like cleanup options (e.g. to normalize
    weights) before exporting, and so on).<br>
    <br>
    However, think we can keep that dev in FBX for now - once the
    correct set of transformations has been sorted out,<br>
    it should be easy to make it generic…<br>
    <br>
    == Bones orientations==<br>
    <blockquote type="cite">
      <blockquote type="cite">
        <blockquote style="margin:0px 0px 0px
          40px;border:none;padding:0px">
          <div style="color: rgb(51, 51, 51); font-family: 'Lucida
            Grande', 'Lucida Sans Unicode', 'Lucida Sans', Lucida,
            Verdana, sans-serif; font-size: 12px; line-height: 1.5em;
            margin-top: 0.4em; margin-right: 0px; margin-bottom: 0.5em;
            margin-left: 0px; text-align: justify; background-color:
            rgb(238, 238, 238); ">And that's not so nice… Issue is, FBX
            bones are not aligned along the same axis as Blender bones
            (former are along -X axis I think, while later are along +Y
            axis).</div>
          <div>
            <div style="color: rgb(51, 51, 51); font-family: 'Lucida
              Grande', 'Lucida Sans Unicode', 'Lucida Sans', Lucida,
              Verdana, sans-serif; font-size: 12px; line-height: 1.5em;
              margin-top: 0.4em; margin-right: 0px; margin-bottom:
              0.5em; margin-left: 0px; text-align: justify;
              background-color: rgb(238, 238, 238); ">
              In current code, we do not rotate bones at all. This means
              they will import rotated in other apps, and files from
              other apps will import with rotated bones in Blender.</div>
          </div>
          <div>
            <div style="color: rgb(51, 51, 51); font-family: 'Lucida
              Grande', 'Lucida Sans Unicode', 'Lucida Sans', Lucida,
              Verdana, sans-serif; font-size: 12px; line-height: 1.5em;
              margin-top: 0.4em; margin-right: 0px; margin-bottom:
              0.5em; margin-left: 0px; text-align: justify;
              background-color: rgb(238, 238, 238); ">
              This is not so nice, but it has a great advantage -
              skinning itself is OK, i.e. no distortions of animated
              rigged meshes, etc.</div>
          </div>
          <div>
            <div style="color: rgb(51, 51, 51); font-family: 'Lucida
              Grande', 'Lucida Sans Unicode', 'Lucida Sans', Lucida,
              Verdana, sans-serif; font-size: 12px; line-height: 1.5em;
              margin-top: 0.4em; margin-right: 0px; margin-bottom:
              0.5em; margin-left: 0px; text-align: justify;
              background-color: rgb(238, 238, 238); ">
              I tried hard (very hard) to export and import corrected
              bones, but with no luck so far (I manage to export and
              import valid 'rest' armature, but pose are always messed
              up in some way). And code from old 6.1 does not help me
              here, I have the feeling it was buggy too (might be wrong,
              of course, but could not get new code working based on it
              at least). Admittedly, I’m not a matrix expert, there is
              probably some ways to handle this, but I’m really tired of
              searching. :/</div>
          </div>
        </blockquote>
      </blockquote>
    </blockquote>
    <blockquote type="cite">
      <div>Unfortunately this is quite complicated. Maya doesn't have a
        defined "Bone orientation", and you can specify this while
        building a skeleton. Here is a screenshot of the joint editor
        tool:</div>
      <div><img alt="Inline-Bild 1"
          id="211a6dcd-1466-46a4-8c3a-a966fa690486" apple-width="yes"
          apple-height="yes"
          src="cid:part3.07030801.03070707@wanadoo.fr" height="379"
          width="326"><br>
      </div>
      <div>(This dialog is cut-off on the right side, you can actually
        specify any axis as primary axis. I did that for X and Y in the
        test files,) </div>
      <div><br>
      </div>
      <div>There seems to be a difference in concept as well: In Maya
        you edit the joints between bones, and the visible bone just
        connects child joints to parent joints:</div>
      <div><a moz-do-not-send="true"
href="http://download.autodesk.com/global/docs/maya2014/en_us/files/CSS_Joints_and_bones.htm">http://download.autodesk.com/global/docs/maya2014/en_us/files/CSS_Joints_and_bones.htm</a><br>
      </div>
      <div><br>
      </div>
      <div>So during bone export I can think of these options, that a
        user may choose depending on use-case:</div>
      <div>
        <div>  - leave it alone. If the Y-axis points along a bone in
          Blender it will point along it in FBX<br>
        </div>
        <div>  - just treat it like other transforms and apply
          global_transform</div>
        <div>  - align a specific axis with a child. This transform
          would not be reversible during import.</div>
        <div>  - align Y in blender with specified axis in fbx. That
          does something similar to the up-axis conversion and lets a
          user decide which axis to use.</div>
      </div>
      <div>Similar during import:</div>
      <div>  - leave alone</div>
      <div>  - align the Y axis to a child</div>
      <div>  - just apply the global_transform</div>
      <div>  - align Y with a specific axis</div>
      <div><br>
      </div>
      <div>I don't have experience with the other major modelling apps,
        so maybe there are more useful options, or options that will
        never be useful.<br>
      </div>
    </blockquote>
    To summarize, some apps have no orientation concept at all, some
    have various, even configurable forward/up axes, and some (like
    Blender)<br>
    have a strict orientation expectations.<br>
    <br>
    To top it all, afaik FBX does not store any data about that topic!<br>
    <br>
    So I have the feeling we should indeed add several handling on
    import, looks like we can't go without that. :/<br>
    Not quite convinced we should bother about that on export, though.
    Game engines do not have issue about<br>
    current exported armatures, it seems, so… And our export UI is
    already quite cluttered too.<br>
    <br>
  </body>
</html>