Pages

Sunday, June 01, 2014

Blender FBX Tool Test Release 1


I'm almost finished with my fbx support addon for Blender. Here's an overview of features and a download link to a test release.


*Note: The normals and smoothing groups will not affect your displayed mesh in Blender, only in the exported file


*Performance Note: I've tested this on meshes with between 6 and 15000 polys. On my mid-range system (Intel i5-2500 with 8GB of RAM and a Geforce 560ti),
real-time display of normals and my custom angle-based generation algorithm are very slow on anything past 8000 or so polys, depending on the mesh's
density. Checking "Selected Only" in the display section of each tool helps, but will slow things down more as you approach higher counts. I have a
pretty good idea of why it's doing this and will try to optimize things some more soon.


I'll upload some comparison screenshots and full documentation within the next few days. More updates coming soon.



Download Link (Github)

NOTE: Feb 2015: An updated work in progress version of the editor/exporter with new features and much better performance is available in the testing branch. The documentation hasn't been updated with the changes in this build.



Features:

Editor for Vertex Normals:

    - Manual editing per poly or vertex
    - Automatic generation with several presets for different scenarios
        -- presets:
            --- Smooth (Blender default)
            --- Angle-Based (slow but customizable algorithm) - *still buggy on complex meshes
            --- Up-Vector
            --- Bent (facing away from 3d cursor)
            --- Ground Foliage (selected ground based vertices point up, everything else bent from cursor)
            --- (TBD: Edge-Based and Smoothing Group-Based)
    - Allows calculating normals for selected faces or the whole mesh *(selected is slightly bugged when using default (smooth) normals)
    - Normals can be displayed as lines for visual editing
    - copy/paste selected normals between meshes with identical vert locations (buggy/wip, but fixes modular mesh seams when it works)
    - Real-time in Edit Mode


Editor for Smoothing Groups:


    - Manual editing of smoothing groups per face
    - Groups can be displayed as numbers on corresponding faces
    - Real-time in Edit Mode


Customized FBX Exporter:


    - Can export everything from the above addons
    - Can calculate and export tangents and binormals
    - Optional support to export normals generated by asdn's Recalc Vertex Normals addon
    - UDK-specific optimiztions:
        -- b_root is now exported as root bone instead of the exporter creating a new one
        -- limited axis flip settings to things that make sense and labeled them
        -- tangents are very close to what UDK automatically generates



       
       
Installation:

drop the Blender_UDK_FBX_Tools folder into your addons folder and find it as "FBX Normals & Smoothing Tools" in the Addon manager (in the mesh category).






Usage: (for now just descriptions of what each button does

UDK FBX Tools Panel:


Export        - opens custom fbx export menu
Initialize Data - creates custom properties required for the tools to work
        - this changes into two buttons once mesh data has been created:
    - Reset - Resets custom mesh data properties to default
    - Clear - Deletes custom mesh data, disabling the editors
        - enables toggle buttons for sg and vn editors
        - which show/hide editors' menus
Match Grid     - changes the grid scale and grid subdivisions to match it to UDK's units
Debug         - Shows some mesh statistics in console (will be replaced/removed soon)



Smoothing Groups Editor:


Set  - sets selected face to the smoothing group number selected in the text box
Select Group     - selects all faces corresponding to the group number
Show Groups     - Displays group numbers overlay
Selection Only - only display numbers for selected faces



Vertex Normals Editor:

Reset - Resets custom normals to match the mesh's (Typically Blender's auto-generated normals)


    Manual Edit:
X, Y, Z     - normal direction

Face         - face index for selected vertex normal

Show         - sets above x, y, z to the current selection's normal

Set         - sets selection's normal to x,y,z

Real-Time Edit    - changing the values above will update them on selection in real time

Edit All     - moves all normals for selected vertex instead of using face index


    Transfer Normals: (buggy, don't select overlapping verts for this)


Copy     - copies selected vertices' normals to a buffer,

Paste     - pastes buffered normals to the current mesh


    Auto Generation:
Modes:
    Smooth (Default)     - uses Blender's default generated normals
    Up Vector        - every normal points up
    Bent            - every normal points away from 3d cursor location
    Ground Foliage        - selected normals (ground base) point up, the rest point away from cursor location
    Custom (Angle-Based)    - (slow) custom algorithm that calculates normals based on face angles
                - settings:
                    - Face: dot product threshold for face smoothing pass
                    - Vertex: dot product threshold for vertex smoothing pass
*currently disabled:
    Edges            - generate normals based on edges marked as sharp
    Smooth Groups        - generate normals per smoothing group

Reset First     - resets mesh data list to defaults (same as reset button) before calculating normals
Selected only     - calculates normals for selected faces only
        - Note: This works differently with Smooth (default) mode, and may be slower


    Display:

Show/Hide Normals     - enables/disables normals display and display settings buttons

Scale             - length of lines representing normals
Color             - change color of the lines
Selection only         - only display normals for selected faces


Exporter:


Axis flip -     - static mesh is default (Y up -Z forward),
        - skeletal mesh is flipped for UDK character import (Z up Y forward)

Smoothing -    - Off :     - no smoothing is written (probably not a good thing for game-related meshes)
        - Edges:     - edge smoothing - (part of defaultss, also not good for games)
        - Face (Default) - Blender's default smoothing approach is used (0=flat,1=smooth)
        - Groups     - export smoothing groups created by this addon

Normals        - From Editor     : Writes normals generated by Vertex Normals Editor
        - asdn's Addon     : Writes normals generated by asdn's Recalc Vertex Normals addon
        - Default    : Blender's automatically generated normals

Tangents + Binormals - calculates and exports tangents + binormals from provided normals
        - * triangulating the mesh before editing and exporting may make these more accurate, but is not required


(the rest are the same as the default exporter)



Settings for proper importing into UDK and xNormal:

UDK:

Skeletal Mesh with Custom normals:
    export with Tangents + Binormals
    check Import Tangents
   
Static Mesh with custom normals + udk-generated tangents:
    export with or without Tangents + Binormals,
    uncheck Import Tangents,
    check Use Explicit Normals

Static mesh with custom normals + tangents:
    export with both,
    check import tangents
    Explicit normals not required

Either one with Smoothing groups - UDK generated normals:
    export with Smoothing set to Groups,
    uncheck import tangents,
    (if static) uncheck Explicit Normals
    *Note: smoothing groups from this addon currently don't work with xNormal, so this part of the addon is currently experimental.



xNormal:

With custom normals:
    - smooth the mesh (or set 1 in smoothing group editor if using it),
    - export with Tangents + Binormals checked,
    - smoothing set to 'Groups' or 'Face'

With Smoothing groups:
    - set up the groups
    - export with Smoothing set to Groups
    - any normals setting will work for this




NOTE:
Exporting tangents requires matched uv coordinates for each vertex (or there will be an error message), so if you made any changes to the mesh after unwrapping uvs (splitting edges, merging verts, etc), do the following in Blender's UV editor:

Select all UVs, then use
UVs -> Seams From Islands
UVs -> Pin
UVs -> Unwrap
UVs -> Unpin

6 comments:

  1. Hey Isathar, I hope you see this.

    When we tried using your plugin, we could not find the plugin in the addon manager.
    We tried copying the udk_fbx_tools folder (containing the .py files) and tried copying the whole folder (Blender_UDK_FBX_Tools). Neither displayed in the plugin manager.
    We are using Blender 2.72, but have tried it with Blender 2.70 as well.
    Other plugins install fine.

    Do you have any idea on what's wrong? Or could you provide info on how to track down the error?

    Thank you in advance!

    ReplyDelete
    Replies
    1. Hey, thanks for letting me know. It looks like I uploaded a wrong file to Github during the last update.

      I should have it fixed in the next hour or so, and will let you know here.

      Delete
    2. I've uploaded a fix to Github and took the opportunity to upload a new version of the tool while I was at it.

      Delete
  2. Thank you very much!
    We just tested it and everything works fine.

    ReplyDelete
    Replies
    1. One other thing: Scaling doesn't work properly when exporting.
      However, this is not a big deal. I just wanted to let you know. :-)

      Delete
    2. Thanks for the feedback!
      I just uploaded a couple of bugfixes and scaling should be working again (for static meshes, it does strange things to armatures).

      Delete