Supporting Game Developers with Blender 2.71

For the 2.71 release, we’ve been working on improving support for game developers using Blender with external engines. To this end, Bastien Montagne has been working on a new FBX exporter, and I have been evaluating workflows to various external engines. Dalai Felinto has also been hard at work with Cycles baking. Below you’ll find some information on the new goodies you can expect in 2.71 for game developers.

New Binary FBX Exporter

Blender can now export binary FBX files (version 7.4). Some benefits of this new exporter includes:

Textures can be embedded directly in the FBX file (instead of copying to a sub-folder)

New “bake space transform” (only recommended for static models for now, though should work for animated ones too), which allows to get the same rotation values in exported data as in Blender, even though the coordinate system (i.e. up/front axes) do not match. So, for example, your monkey is null-rotated in Blender (-Y, Z) space, with this option, even if you export to Unity (-Z, Y) space, the monkey will still have a null rotation (in other words, the corrective rotation is “baked” into mesh data itself).

Writing correct axes and scale data in the FBX file (not many other apps really make use of this info yet)

Baked animation for both bones and objects. Note “baked” animation means that the animation is played in Blender, and all loc/rot/pos are recorded, hence all indirect animation work, even complex ones based on constraints or drivers (resulting animations are cleaned up, to remove unnecessary keyframes and curves). There are three animation baking modes:

When NLA Strip option is enabled, it will export each strip as an anim stack, gathering everything that is animated by this strip. (i.e. can generate animation for several objects).

When All Actions option is enabled, it will check each action against each object, and if they match, generate an anim stack *only* affecting that object with that animation.

If none of previous options are enabled (or if they do not generate any animation), the whole scene is baked into a single animation stack.

In order to stress-test the new exporter, I got together some assets to create a simple level and a couple of characters. I then tried exporting to Unity, Unreal Development Kit (UDK), and Unreal Engine 4 (UE4). The results are summarized below, for the full notes please check out https://wiki.blender.org/index.php/User:Moguri/ExportDocs.

Unity

What works:

Static meshes (including UVs)

Skeletal meshes

Skeletal mesh animations (including IK constraints)

Flat and smooth shading

NGons

Exporting whole levels

Exporting materials (materials will be created in Unity with the name and color of the exported material, and embedded diffuse textures will be setup)

What doesn’t work:

Collision Meshes (these have to be setup in Unity)

Shape key animations

Object animations

Notes:

The default scale and axis options work well (Scale: 1.00, Forward: -Z Forward, Up: Y Up). Just make sure to set the scaling in Unity (it defaults to 0.1).

UDK

What works:

Static meshes (including UVs)

Exporting materials (materials will be created in UDK with the name and color of the exported material, and embedded diffuse textures will be setup)

Exporting meshes as collision meshes (they must be named UCX_XX, where XX is the name of the mesh that the collision mesh is for)

What doesn’t work:

Exporting whole levels (you’ll need to export individual assets and put them together in UDK)

Skeletal meshes and animations (use the PSK/PSA export instead, it is much more reliable)

Smooth vs flat shading doesn’t seem to work well

Object animations

Shape key animations

Notes:

Textures must be powers of two and a support image format (JPEG isn’t supported, but PNG is)

The default axis options work (Forward: -Z Forward, Up: Y Up)

Set the scale to 100.0

UDK complains about an incompatible FBX version (UDK uses 7.3.0 while Blender exports 7.4.0), but the models still load.

Collision meshes can also be created in UDK (i.e., you don’t have to rely on importing a collision mesh)

UE4

What works:

Static meshes (including UVs)

Skeletal meshes

Skeletal mesh animations (including IK constraints)

Flat and smooth shading

NGons

Exporting materials (materials will be created in UE4 with the name and color of the exported material, and embedded diffuse textures will be setup)

Exporting meshes as collision meshes (they must be named UCX_XX, where XX is the name of the mesh that the collision mesh is for)

What doesn’t work:

Exporting whole levels (you’ll need to export individual assets and put them together in UDK)

Shape key animatons

Object animations

Notes:

Textures must be powers of two and a support image format (JPEG isn’t supported, but PNG is)

Some of these are limitations on Unity’s end. For example, Unity doesn’t read object animations, nor do I think it has a way to get collision mesh information (UDK/Unreal make use of the a special naming convention to find meshes that are intended to be used for collision). As for shape key animations, that’s something we can work on for the exporter (Unity will read the data if we write it out correctly). The first step is to get shape keys exported in such a way that Unity reads them in as BlendShapes.

Good stuff, glad to see that FBX export getting some love finally! I’d like to see a lot more attention paid to import as well, however. Many (most?) workflows involve jumping between multiple packages multiple times, and it’s currently a game breaker that there is NO reliable way to get rigged characters from other packages into Blender. As another note, a really simple fix would be to allow importing multiple objects at once. The Steam Workshop, for example, gives character files that come in pieces, and some of them have 20+ .fbx files. Importing them one by one is a hassle.

i tried the test build a few days back to find that with the “new” fbx 7.3 exporter you can’t select “deform bones only” which means if you try using the rigify or makehuman rig it will export all the bones in the file.

would it be possible to add it back into the options, btw its still there for the 6.1 version

There is still an issue with lightmap baking. You can either bake direct diffuse lighting, indirect diffuse lighting, and combined which for some reason bakes the diffuse color too. This isn’t usefull for lightmap baking. An option is needed to bake a combined bake with direct and indirect without the diffuse color. The diffuse influences rays but shouldn’t be simply be baked over.

This is not really the place for BGE support since this article is talking about using Blender to export to other engines like Unity, UDK, and UE4. You can try to get help from the BlenderArtists forums or the #gameblender or #blender IRC channels on Freenode.

When i import the fbx in to unity it works perfect except that the mesh its triangulated, this maybe no a great issue to unity (for obvious reasons) but if i have to send it the fbx to max its a problem also the importer imports fbx triangulated.
im not sure if this is a bug a limitation or simply something that its not part of the idea of the importer

by the way, thanks for your work it makes possible for me to start working as a game artists, a big “i have to” that i have since i was a child ^-^

The update to the FBX exporter somehow broke the automatic import of .blend files in Unity. Could be a really painful surprise for people with lots of Blender assets in a Unity projecthttps://developer.blender.org/T40826

First of all, great work and thanks für investing so much time to improve our beloved blender ! I ran into the same problem Arnaud described earlier, saveing a .blend file to the unity assets folder will not work anymore. Even though I have installed previous versions of Blender (2.65 up to 2.71), none of these worked and I always get “Blender could not convert the .blend flile to .FBX file” in Unity. Does Unity open the Blender version attached to .blend files and use its FBX Exporter ? Is there any workaround ? And is it possible to export the FBX of a scene in cycles where Unity picks up the materials ? Right now I have to go back to Blender Internal Renderer and convert the materials, so that after exporting in fbx, Unity creates a shader for each material. Using Cycles materials Unity creates only one material.

I have a question if you don’t mind. Is it possible now to export a model into unity from blender which stands from many mesh pieces and is not only animated by a skeleton but also by a mesh using the ‘mesh deform modifier’. If yes, how? If not will it be possible or shall I use only armature for rigging. Thanks!

I exported a simple static mesh with collision and imported in UDK 3.
The player start object stopped working when attempting to play the level. After removing the mesh, the player start worked just fine.
Strange..

blend file to the unity assets folder will not work anymore. Even though I have installed previous versions of Blender (2.65 up to 2.71), none of these worked and I always get “Blender could not convert the .blend flile to .FBX file” in Unity. Does Unity open the Blender version attached to .blend files and use its FBX Exporter ? Is there any workaround ?

Nice Information saol thank you address this issue very well have been something I hope everything gets better peanut subject of the system should work properly also have strong competitors in the meantime how many how many fulltime.

I have a number of animations in Lightwave that I wish to export to blender.

In version 2.73, the import of LWO seems to be broken.
In particular the import of Endomorphs seems not to work. Even a very simple model of a Pacman with one base mesh and a single set of displaced points to open the mouth fails to import correctly.

blend file to the unity assets folder will not work anymore. Even though I have installed previous versions of Blender (2.65 up to 2.71), none of these worked and I always get “Blender could not convert the .blend flile to .FBX file” in Unity. Does Unity open the Blender version attached to .blend files and use its FBX Exporter ? Is there any workaround ?

Yeah, Unity does not actually support .blend files, it just opens them with Blender and export them with (old, deprecated and unmaintained 6.1) FBX exporter. So work around is to handle FBX export yourself (which is much recommended anyway) – and/or file a bug at Unity.