You are on page 1of 2

Texturing models in Blender for XNA

To use textured models in XNA, these models must have the texture le mapped to the models faces. This short tutorial (transcribed from http://www.youtube.com/watch?v=obB9T3jXlak) shows how to map textures to models in Blender and how to export them to XNA in two formats: .x and .fbx.

1
1.1

UV Mapping in Blender
Flattening a model and exporting texture.
1. Add window in Blender (click and drag on the top right corner) and set the view to UV/Image editor. 2. Create a new box, go to Edit Mode and to Edge Select Mode. 3. Select edges to peel the box and click on Mark Seam, on the left panel. 4. Alternatively to 2-3, you can select all faces in Edit Mode and then press U and select Smart UV Project (then go to point 7). This could work for a simple model, but it can be not good enough for complex ones. 5. Change to Face Select Mode and select all faces of the object (press A). 6. Press U and then select Unwrap to unwrap the model. 7. Use S, G and R to place the faces in the UV to your convenience. 8. In the UVs Menu (down in the UV Editor window), select Export UV Layout. This will create a PNG le that you can edit externally to paint the faces of the cube.

1.2

Texturizing the model

1. Go to Object Mode and select the box. 2. In the left panel, go to Materials. Add a new material, give it a name and give it a base color. 3. With the new material selected, go to Textures. Add a new texture and give it a name. 4. Select Image or Video as Type. Down in section Image, Open the le with the painted image. 5. Go to Edit Mode. In Textures, section Mapping, change Coordinates to UV.

1.3

Displaying the texture in the 3D view

1. Go to Edit Mode. In the UV Editor, select the image through the shortcut (image icon in bottom bar). 2. In the 3D View window, open the right panel (Plus sign on the top right corner, or press N). 3. In section Display, select GLSL in Shading and tick on Texture Solid.

Exporting as Autodesk FBX (.fbx)


1. When exporting to FBX, you must follow the usual exporting procedure: (a) (b) (c) (d) In object mode, select your object, press U and select the option Objects & Data & Materials+Tex. Press Control+A and select the option Location. On the left panel, select also Rotation and Scale. Go to Menu File Export Autodesk FBX (.fbx) In the left menu, near the bottom, make sure that the option XNA Rotate Animation Hack (or similar, depending on the Blender version) is selected.

2. In XNA, once you have the model added to the Content Project in Visual Studio, you have to right-click on it and select the option Properties. In Content Processor: Model - XNA Framework you have to assign the value -90 to the property X Axis rotation. 3. For .FBX, there is no need to include the texture image le in the Content project in Visual Studio. 1

Exporting as DirectX (.x)


1. First, we need to enable the exporter in Blender. (a) Menu File User Preferences Import/Export or Addons (depending on the Blender version). (b) Check the checkbox for DirectX. (c) Click on Save as Default (bottom left of window). 2. As in FBX, follow the exporting procedure: (a) In object mode, select your object, press U and select the option Objects & Data & Materials+Tex. (b) Press Control+A and select the option Location. On the left panel, select also Rotation and Scale. (c) Go to Menu File Export DirectX (.x) (d) No hacks need to be done when exporting to .x 3. For .X, you do need to include the texture le in the Content Project in Visual Studio.

You might also like