Believe me or not Unity 3D will be the next hype in the indie game industry and once you have discovered this tool and exported your 3D scenes to your iPhone, Android or even Flash (thanks to the new Molehill support) you will understand why. But that’s not the point of our discussion 😉 There is a topic that comes very often in forums concerning the export/import of textures in Unity 3D: how to export 3D objects or geometry made with Blender (up to 2.5) in Unity with textures. Yes with textures… The problem is that the workflow is not very clear and often textures are missing what is pretty annoying because once imported in Unity 3D you will need to assign them manually over the Material options… it’s a real pain but fortunately there is a nice solution…

Let’s get started!

Prerequisite:

You will need to download following software to be able to realize this tutorial:

  1. Blender 2.5 (http://www.blender.org/download/get-blender/)
  2. Unity 3D 3.5 (will also work on 3.4.2) (http://unity3d.com/unity/download/)
  3. Autodesk FBX Converter (http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775855)

Good knowledge of UV Unwrap and modeling with Blender, but don’t panic you will be able to download the final textured files.

Step 1: Open Blender and build a simple 3D model

This won’t be the house of your dream, but just a simple grungy 3D house.

As you will see our house is composed by two objects: the roof (I’ve simplified it) and the building part that will contain windows and a door.

 

Select the object (let’s say the roof) and go into Edit Mode and UV Unwrap to get the single unwrapped texture. Depending on your model, you will need to put some seams in order to get a nice unwrap. Save the unwrapped parts as a picture and edit it in your favorite painting program like Photoshop.

You will have these two textures:

Texture 1: a door, a wall and two windows

Texture 2: the roof (very simplified!)

After a few minutes of modeling and texturing, our nice house is finished. To polish your textures you can apply a small blur on it and put some shadows in order to give more volume. This trick is used in almost every 3D game you’ve played.

Note: For the purpose of this tutorial I have built a house with two textures. Why? To show one option you shouldn’t miss when exporting out of Blender.

House model in Blender

Step 2: Export preparation

So now we have finished modeling our house. In order to simplify the export and the import into Unity 3D, I always remove the Lamp and the Camera from the Blender scene.

Notice the removed lamp and camera

Now go into Object Mode and select (Shift + Right Mouse Button) the roof and the building part. You have now selected each object of the scene thus forming the house.

All objects (geometries) are selected (roof and building)

Step 3: Blender export with the FBX format

I use to export my Blender under the FBX (http://en.wikipedia.org/wiki/FBX) format because it’s one of the input formats of Unity 3D along with 3DS and other ones. By the way FBX can also be used by the Microsoft XNA SDK (a framework for building XBox and Windows games) or even with the newest Adobe Flash Molehill frameworks (http://www.mixamo.com/adobe-molehill). If you are interested check this webpage: http://msdn.microsoft.com/en-us/aa937791, so you can import your 3D monster, house or whatever you’ve modeled with Blender directly into your game conception environment. Nice isn’t it?

Let’s continue: check that your have correctly selected all objects of your house. Go to File -> Export -> Autodesk FBX

Autodesk FBX export option in Blender

A window will open and there are some parameters to check and uncheck. Here is how your Blender export panel should look like:

FBX export settings in Blender 2.5

Give a name to your file (house.fbx) and press on Export. Voilà now you have your house in FBX format.

Step 4: Autodesk FBX Converter

Now you will ask yourself: hey why do we need to reconvert our house.fbx in *.fbx format again with the Autodesk FBX Converter? Good question! The problem is if you are going to import it into Unity3D you won’t get any texture on your house and it will look grey and not very nice, because Unity won’t be able to know where your texture files are saved and will not automatically import them…

 

Oh… no texture in Unity 3D 🙁 Don't panic there's a solution!

What we are going to do with the Autodesk FBX Converter is to embed the media. To make it short we are packaging all our textures and our 3D model into one file. The advantage is also that you can send a colleague or a friend a single FBX file containing all the textures and the 3D model without having to worry about the texture’s paths, because they are directly embedded into the *.fbx file.

The technical background is the following one: if you open your house.fbx with a text editor you will see following lines that show the relative path to the textures.

Short extract of the content of a FBX file

Now open the Autodesk FBX Converter and drag’n’drop your house.fbx in the left side. You will see on the right side (Destination File) that there are some options. Check “Embed Media” and “FBX Save Mode” Binary. Press “Convert” and voilà you will get a brand new *.fbx and if you check the size of the converted file, it’s bigger. In fact you have embedded all the textures within this new *.fbx.

Settings in Autodesk FBX Converter with the options Embed media and Save Mode as Binary selected

Step 5: Importing into Unity

Now it’s a piece of cake: open Unity and create a new scene and project (you can import some other packages and assets later, like a Terrain or a Skybox later) and of course drag’n’drop your new house.fbx into the project panel. During the import you will see a small gauge with the name of the embedded media being imported (it’s a good sign that your texture will be correctly imported into the project).

Hurray, now you have your fully textured house imported into Unity. Nice isn’t it? We are almost finished: select the House object and in the Inspector panel under “Animations” select “Don’t import” and click on “Apply”.

Inspector showing the imported FBX in Unity 3D

Now you can drag’n’drop your House prefab into the scene:

Our house in Unity 3D. Notice that our texture files were directly converted into materials and correctly imported.

Step 6: Unleash your creativity with Unity 3D

At this point you have now successfully imported your Blender generated and created house into Unity 3D with all the correct textures. It’s time for some tweaking: we are going to add a Lamp (or better said a sun) a Terrain and of course a nice Skybox. Here is my final result (with some shadows and a tree. Use the Arrow Keys and your mouse to move into the scene):

Click here to see the full 3D scene

Final house in Unity 3D with skybox and tree. Click on the picture to load the 3D scene with Unity 3D webplayer

Download the tutorial’s files

Liked this tutorial? Here are the important files (house.fbx, house.blend and the two textures) in a zip file:

Download the files for this tutorial

💬 Comments

Don't hesitate to share your comments. I'm always happy to read your input!