Professional Documents
Culture Documents
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
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
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.
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