FBX 7.4 Updates – III

Since last report, main missing feature was added to Export, and Import was greatly improved :

* Shapekeys export has been added, including animation (only for relative shapes, n o support for absolute ones’ animations currently).

* Armatures import was added (though there is a remaining unclear issue about bones’ orientation).

* Shapekeys import was added.

* Limited animation import was added, for loc/rot/scale of objects and bones, and values of shapekeys.

Last point needs some precisions – we currently always read FBX curves assuming linear interpolation. This means that if you FBX file has some fancy Bézier-like interpolated anim curves, results will be rather poor. In a word: bake your animations at export time! Note complete import support for FBX anim curves is a TODO, but not a top-priority one currently…

As usual, a bunch of more minor enhancements and bug fixes was done too.

And as usual, we need testing, testing and even more testing of the whole FBX io addon – complete feature should be in Blender nightly builds within a few hours. Just be kind, and if you find some failures, report them with a tiny FBX file illustrating the issue, not a whole multi-MB project one. 😉

Advertisements

15 thoughts on “FBX 7.4 Updates – III

  1. Hello Bastein,

    This is great news! I tested in both Unity 4.5.2f1 and Unreal 4.3; in both engines I have no issues, everything is working great! 🙂 Shapekeys export worked like a charm. I’ll keep testing and report in the bug tracker if I get issues.

    Thank you!

  2. just tested the fbx ‘import’ and got a load of errors on a skeletal mesh which i exported from UE4.3, just tried importing an fbx which i exported from blender 2.71 which is ok except the mesh gets rotated x=+90 though that file imports fine into UE4.3, can supply the content if ness

  3. hi Mont, i know you said post on the dev site but i’m at a total loss there,
    just done some testing with the Aug 4th blender build (blender-2.71-a90e49e-win64) the fbx importer is great so far even imports the skele meshes i exported from UE4, the issue i’m having now is on import of the test anim, the arms seem to get rotated 90 degrees.
    i’ve include the fbx + blender files for you to check, not sure if you have access to UE4 but i can supply the assets as well if ness.
    https://dl.dropboxusercontent.com/u/34288586/UnrealProjects.rar

    btw your doing a great job this is going to help a whole lot of people BIG THANKS

  4. Hi Mont, I’m having some problems exporting Shape Keys to UE4. I can get them with the old binary exporter, but for some reason they are not appearing in UE4 when I use the binary 7.4 export. Are there any options I should be marking? Thanks!

    • No, shape keys are automatically exported if present (and they do have some data). Since they are working fine with Unity, my wild guess would be UE4 does not support newest format of shape keys, so not sure what to do right now except using old exporter if you need them… :/

      • They work fine with the ASCII exporter, but I get the extra-bone issue 😦 Any workaround on that? Thanks for your help!

  5. Hi there mont29,

    Thanks for your amazing fbx exporter solution for blender. I wonder if you can help me manually adding vertex color alpha at your bin exporter. I know you dont want to add it in official release, but many artist as me need alpha layer for some shader and drawcall tweaks in the videogame world. Another artist, launched a simple modification of “export_fbx.py” that uses a layer of vcols tagged with “_ALPHA” to export as vertex color alpha. Thas the code mod:

    ORIGINAL:

    # Write VertexColor Layers
    collayers = []
    if len(me.vertex_colors):
    collayers = me.vertex_colors
    t_lc = [None] * len(me.loops) * 3
    col2idx = None
    _nchunk = 4 # Number of colors per line
    _nchunk_idx = 64 # Number of color indices per line
    for colindex, collayer in enumerate(collayers):
    collayer.data.foreach_get(“color”, t_lc)
    lc = tuple(zip(*[iter(t_lc)] * 3))
    fw(‘\n\t\tLayerElementColor: %i {‘
    ‘\n\t\t\tVersion: 101’
    ‘\n\t\t\tName: “%s”‘
    ‘\n\t\t\tMappingInformationType: “ByPolygonVertex”‘
    ‘\n\t\t\tReferenceInformationType: “IndexToDirect”‘
    ‘\n\t\t\tColors: ‘ % (colindex, collayer.name))

    col2idx = tuple(set(lc))
    fw(‘,\n\t\t\t ‘.join(‘,’.join(‘%.6f,%.6f,%.6f,1’ % c for c in chunk)
    for chunk in grouper_exact(col2idx, _nchunk)))

    fw(‘\n\t\t\tColorIndex: ‘)
    col2idx = {col: idx for idx, col in enumerate(col2idx)}
    fw(‘,\n\t\t\t ‘
    ”.join(‘,’.join(‘%d’ % col2idx[c] for c in chunk) for chunk in grouper_exact(lc, _nchunk_idx)))
    fw(‘\n\t\t}’)
    del t_lc

    MODIFIED:

    # Write VertexColor Layers
    #======================== Vertex Color Alpha Modification Begin ===========================
    ALPHA_SUFFIX = ‘_ALPHA’
    collayers = []
    if len(me.vertex_colors):
    alphalayers = {}
    for name,layer in me.vertex_colors.items():
    if name.endswith(ALPHA_SUFFIX):
    refname = name[:-len(ALPHA_SUFFIX)]
    alphalayers[refname]=layer
    else:
    collayers.append(layer)

    t_lc = [None] * len(me.loops) * 3
    if alphalayers:
    t_lca = [None] * len(me.loops)*3
    col2idx = None
    _nchunk = 4 # Number of colors per line
    _nchunk_idx = 64 # Number of color indices per line
    for colindex, collayer in enumerate(collayers):
    collayer.data.foreach_get(“color”, t_lc)
    iter_tlc = iter(t_lc)
    if collayer.name in alphalayers:
    alphalayers[collayer.name].data.foreach_get(“color”, t_lca)
    iter_tlca = (sum(c)/3.0 for c in zip(*[iter(t_lca)] * 3))
    lc = tuple(zip(*[iter_tlc,iter_tlc,iter_tlc,iter_tlca]))
    else:
    from itertools import repeat
    lc = tuple(zip(*[iter_tlc,iter_tlc,iter_tlc,repeat(1.0)]))

    fw(‘\n\t\tLayerElementColor: %i {‘
    ‘\n\t\t\tVersion: 101’
    ‘\n\t\t\tName: “%s”‘
    ‘\n\t\t\tMappingInformationType: “ByPolygonVertex”‘
    ‘\n\t\t\tReferenceInformationType: “IndexToDirect”‘
    ‘\n\t\t\tColors: ‘ % (colindex, collayer.name))

    col2idx = tuple(set(lc))
    fw(‘,\n\t\t\t ‘.join(‘,’.join(‘%.6f,%.6f,%.6f,%.6f’ % c for c in chunk)
    for chunk in grouper_exact(col2idx, _nchunk)))

    fw(‘\n\t\t\tColorIndex: ‘)
    col2idx = {col: idx for idx, col in enumerate(col2idx)}
    fw(‘,\n\t\t\t ‘
    ”.join(‘,’.join(‘%d’ % col2idx[c] for c in chunk) for chunk in grouper_exact(lc, _nchunk_idx)))
    fw(‘\n\t\t}’)
    del t_lc
    if alphalayers:
    del t_lca
    #======================== Vertex Color Alpha Modification End ===========================

    The problem is that FBX 6.1 exporter dont have features that I need. Could you explain to me how to modify this code part to use the tagged “_ALPHA” layer and not a fake one:

    # Write VertexColor Layers.
    vcolnumber = len(me.vertex_colors)
    if vcolnumber:
    def _coltuples_gen(raw_cols):
    return zip(*(iter(raw_cols),) * 3 + (_infinite_gen(1.0),)) # We need a fake alpha…

    t_lc = array.array(data_types.ARRAY_FLOAT64, (0.0,)) * len(me.loops) * 3
    for colindex, collayer in enumerate(me.vertex_colors):
    collayer.data.foreach_get(“color”, t_lc)
    lay_vcol = elem_data_single_int32(geom, b”LayerElementColor”, colindex)
    elem_data_single_int32(lay_vcol, b”Version”, FBX_GEOMETRY_VCOLOR_VERSION)
    elem_data_single_string_unicode(lay_vcol, b”Name”, collayer.name)
    elem_data_single_string(lay_vcol, b”MappingInformationType”, b”ByPolygonVertex”)
    elem_data_single_string(lay_vcol, b”ReferenceInformationType”, b”IndexToDirect”)

    col2idx = tuple(set(_coltuples_gen(t_lc)))
    elem_data_single_float64_array(lay_vcol, b”Colors”, chain(*col2idx)) # Flatten again…

    col2idx = {col: idx for idx, col in enumerate(col2idx)}
    elem_data_single_int32_array(lay_vcol, b”ColorIndex”, (col2idx[c] for c in _coltuples_gen(t_lc)))
    del col2idx
    del t_lc
    del _coltuples_gen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s