From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Exporting Notes

Goal: Export a level and character to external engines to test our pipeline. Any issues, notes, gotchas, etc., encountered along the way will be recorded in this document.

Unity

Resources

  • Unity Cookie "Exporting Characters from Blender to Unity" tutorial [link]

Axis and Scale

The default axis and scale options for the FBX exporter work well for Unity. These are:

Scale: 1.00
Forward: -Z Forward
Up: Y Up

Levels

Creating a level in Blender and then exporting the whole level seems to work fine in Unity.

Materials

When importing materials, Unity will create a material of the same name and give it a Diffuse shader. The diffuse color copies over, but it appears to be the only thing. For examples, textures do not (maybe they will after embedding textures is fixed). For now, the textures have to be assigned (the Unity Cookie tutorial in the Resources section talks about this).

Collision Meshes

These have to be added in Unity (otherwise there will be no collision with the imported meshes). They can be added selecting the mesh and going to Component->Physics and selecting a collider type for the mesh.

Animations

The new binary FBX exporter has two ways to export animations, via "NLA Strips," or an "All Actions" option. The NLA Strips option will (according to the tooltip), "Export each non-muted NLA strip as a separated FBX's AnimStack, if any, instead of global scene animation." The All Actions option is to try and keep compatibility with the old ASCII exporter, and is what the Unity Cookie tutorial uses.

The All Action option compares each action in the scene to each object to check for compatibility. If the action and object are compatible, the action is assigned to the object. "Compatible" in this case means the object can make use of all of the fcurves in the animation. This can cause some problems with actions not exporting when you expect them to. For example, if you have an armature action that references a bone that no longer exists on the armature (e.g., you've deleted the bone at some point), then the action will still play in Blender, but will not export with the All Actions option. The NLA Strips option can be used to work around this (or the actions can be cleaned up).

Other/Misc

  • Unity doesn't appear to support embedded textures
  • Flat and smooth shading both work (including mixing flat and smooth shading in one mesh)
  • NGons work
  • Shape key animations do not appear to export
  • Shape keys themselves only export with the ASCII exporter (reported as T40305)
    • These are imported into Unity as BlendShapes, and require Unity 4.3
  • IK constraints appear to work
  • Animations with shape key drivers appear to not work
  • The ASCII exporter only exports actions on Armatures, the binary exporter will export object actions, but it seems Unity doesn't do anything with them (I think it wants all animations to be skinned meshes)

UDK

Scaling

When creating assets for UDK, you'll want to either create large models, or use the Scale option when exporting. By default, one Blender Unit tends to be interpreted as one meter, but one Unreal Unit is one centimeter. In other words, you'll want to make your models about 100 times larger, or they will be really small in UDK.

Levels

When exporting a level to UDK, the importer will just take all of the pieces and add them to the Content Browser. In other words, you'll have to build the level using UDK.

Materials

Similar to Unity, you'll get materials created in the Content Browser for your imported assets, but you will need to rebuild the materials in UDK. To import texture into UDK, make sure they are PNG images and that each dimension is a power of 2. If your image imports into UDK as a "SubstanceAirImageInput," then double-check the size and image format. When you have your image imported as a Texture2D, you can open the imported materials in the Material Editor and assign the textures to their various inputs (e.g., diffuse, spec, etc.).

Collision Meshes

Static meshes do not automatically get collision meshes in UDK. There are two options:

  • Make the collision mesh in Blender and name it UCX_XX (replacing XX with the name of the object for which the collision mesh is for)
  • Create the collision meshes in UDK. The static meshes will have a "NO COLLISION MODEL!" warning on them in the content browser. Double-click on the static meshes in the content browser, select Collision in the menu bar, then select a shape. In the toolbar, you can select the Show Collision option (green object with a pink outline) to see the collision mesh that UDK generated for your object.

If you reimport the static mesh (e.g., to play with scaling), you'll need to recreate the collision mesh to match the new size/shape if the collision mesh was created by UDK.

Skeletal Meshes and Animations

For skeletal meshes and their animations, it is better to use the PSK/PSA exporter addon (it's disabled by default, so you'll need to enable it). This handles exporting to UDK pretty smoothly (including scaling, and coordinate system conversions). FBX on the other hand seems to generated garbage skeletal meshes and animations in UDK. I've had UDK crash when trying to import or access animations from the exported FBX file. I'm not sure if this is an export issue or an import issue (Unity seems to work just fine). There is an error about mis-matched FBX versions, but neither the ASCII or binary exporter seem to work.

The PSK/PSA exporter creates two files, the PSK file is the skeletal mesh and the PSA file is the animations. After importing the PSK file into UDK, you'll need to create a new animation set and import the PSA file.

UE4

Axis and Scale

The default axis values appear to work fine, but scale probably needs to be set to something like 100:

Scale: 100.00
Forward: -Z Forward
Up: Y Up

However, it's generally better to just create a large model since scaling doesn't always seem to work correctly when exporting (especially on skeletal meshes).

Levels

Same as UDK.

Collision Meshes

This is similar to UDK.

Static Meshes

These can be imported via FBX. The embed texture option works, and UE4 picks up the texture. If you have multiple assets in a single FBX, make sure to uncheck the "Combined Meshes" option under Advanced -> Mesh in the UE4 static mesh importer. Also, the same scaling issues as UDK still apply to UE4. No FBX warnings were generated with my test file, however, when building lighting, I had warnings/errors about invalid lightmap settings. I followed some ideas mentioned in this forum thread to fix the issue.

Skeletal Mesh

This seems to import smoothly using Blender's binary FBX exporter. The skeletal mesh, material, skeleton, and animations appeared to import correctly. One problem is, the scale option seems to mess up the animations. There were also some warnings printed to the log that might be worth investigating.