How to correct scale and rotation of static Blender models for Unity

CoverBltoUn

Lately I was learning how to use Blender to make 3D models (mostly because it’s polished and free). As a programmer, I wasn’t attempting to be a professional artists, but I did want to learn the basics in order to facilitate game development.

Blender is a pretty cool program if you learn the shortcuts and interface (I found a great tutorial here at “Games From Scratch”). However, if you want to use models made with Blender in Unity3D, the scale and orientation will be not be set in a way you would expect. This tutorial attempts to teach how to fix the scale and orientation of the Blender model so it shows up correctly in Unity.

Take note that this will be a manual orientation and scale fix. This doesn’t utilize scripts in either Unity or Blender. This tutorial assumes that you are at least a little familiar with navigating the interfaces of both programs (I consider myself a beginner in Blender, so hopefully Blender-beginners should be able to follow along). This tutorial uses Unity 4.5 and Blender 2.7.

When making the model itself, don’t scale or rotate it until you’re done with it. I don’t know how to animate Blender, so I don’t know if this procedure will work with animated meshes.

When dealing with axes, assume that the X-axis in Blender will be the X-axis in Unity, the Y-axis in Blender will be the Z-axis in Unity, and the Z-axis in Blender will be the Y-axis in Unity.

UnityVsBlenderAxis

Before you apply any scale or orientation fixes, make sure you’re in Object Mode (it’s at the bottom of the 3D view panel).

ObjectMode

Now select the model by right clicking it. If your model composes of multiple object, you can select all of them by pressing A (they should all have an orange outline if selected). You may have to press A twice if there is no orange outline.

**Update: Do the scale fix only if you modeled something from a standard Blender cube, which has the size of 2 world units. If you modeled from a cube with the size of 1 world unit, you don’t have to do the scale fix! Skip the next two paragraphs if that’s the case.

Next, to scale everything, press S (for scale). You’ll notice that the mouse position can determine the scale you want, but we want a precise scaling, so simply type “0.5” without quotes and press Enter. We scale by half because Blender’s world units are twice the size of Unity’s.

To apply the scale permanently, press Ctrl+A. Doing that makes a menu pop up. Click on “Scale”. Take note that if you’re scaling, you may have to reposition the model or scene so that you get the scene’s origin positioned the way you like. Unity takes Blender’s world origin as the origin of the imported model.

Apply Scale

Now that the scale fix was applied, we can do the rotation fix. Make sure everything is selected and press R (for rotate). Just like with scaling, you’ll find that mouse movement rotates the selected objects. But we want to do a particular rotation: 180 degrees around Blender’s Z-axis. To do that quickly, assuming you already pressed R, press Z, then type 180, and press Enter. From my experience, doing this rotation will correct the orientation of your model in Unity assuming you follow the rest of this procedure correctly.

Just as with scale, to apply rotation permanently, press Ctrl+A. In the menu that pops up, click “Rotation”.

Apply Rotation

Now the Blender model is ready for export. The usual file format for 3D models in video games are FBX files and Unity can import those, so that’s what we’ll use when exporting from Blender.

Make sure everything you want is selected and go to File → Export → Autodesk FBX (.fbx). (See picture below)

ExportFileMenu

The export screen shows up. Choose the directory you want and name the FBX file, but do NOT click “Export FBX” yet.

ExportScreenNamingFile

On the left side are all the FBX export options (you may have to scroll down there to see them). Make sure that “Selected Objects” is checked.

ExportScreenSlectedObjects

Aside of “Selected Objects”, the other export setting should be the default setting (assuming a fresh install of Blender). In particular, check that “Forward:” is “-Z Forward” and that “Up” is “Y Up”. This is important, because the orientation of the FBX model will be imported incorrectly in Unity if these setting are not set correctly. (See picture below)

ExportScreenAxes

After verifying the settings, you can click the “Export FBX” button (on the upper right corner).

Now import the mesh into your Unity project the way you usually do (I just drag and drop). We are not done yet. There is a minor annoyance when importing FBX files into Unity. The scale is by default set to 0.01. That can be fixed in the model’s import settings in Unity. First click on your model in the project browser.

UnityModelClick

The model’s import settings should show up in the inspector. Now find the “Scale Factor” field (it should read 0.01). Change it to 1. Then click the apply button at the bottom right of the inspector. (See image below).

UnityModelSizeFix

Now your model should be ready for use in Unity. Hopefully that was helpful.

Advertisements

2 thoughts on “How to correct scale and rotation of static Blender models for Unity

Comments are closed.