Exporting a Static Mesh from Blender

From Multiverse

Jump to: navigation, search

Contents

Overview

TUTORIAL BROKEN PLEASE SEE LINK FOR SOLUTION Ogre Plugin replacement

Blender is an open source 3D modeling and animation tool. This tutorial explains how to export a static model (mesh) with associated texture from Blender 2.43 using the COLLADA 1.4 plugin. For information on creating and exporting animated models, see Exporting Animations from Blender.

This tutorial assumes you have some familiarity with the Blender interface.

This tutorial was written by Multiverse Developer Matro.

Forum discussion

This tutorial is discussed in a post in the Multiverse Developer Forums.

Prerequisite

The Blender COLLADA plugin requires you to install Python. Download Python version 2.4.4 and install it on your system before you start Blender.

Note: You must install a standalone version of Python even if you have installed Cygwin's Python module.

Create a static model in Blender

For this tutorial you are going to use the default cube that you get when you start Blender. The first thing that you are going to do is scale the cube up a bit since it would be very small if you exported it "as is." The COLLADA Plugin uses the meter="0.01" name="centimeter.

First, select the cube by pressing the A key (which toggles object selection). Then, to scale the cube, press the S key, type "10," and press Enter.


Image:DefaultCube.jpg

With the cube selected, click on the Object button then choose Snap | Selection --> Grid. This places the cube on top of the grid. Also, as shown in the figure above, the Materials tab, the (TextFace) is selected.

Convert to triangles

Before continuing, convert the cube mesh to triangles. Follow these steps:

  1. Click the Mode button and choose Edit Mode.
  2. Click the Mesh button and choose Faces | Convert Quads to Triangles.

Add a texture

To add a texture, follow these steps:

  1. Click the Mode button and choose UV Face Select.
  2. Change the Draw Type to Textured. Click on the "Draw Type" button, and choose Textured, as shown below.

    Image:Drawtype_textured.jpg

  3. To split the screen, move the mouse pointer to the border below the top menu bar; it will change to look like a vertical line with arrows at each end. Right click and choose Split Area. You will now have two viewports, as shown below:

    Image:Split.jpg

  4. At the bottom of the left window, click on the Window Type and select UV/Image Editor, as shown below:

    Image:Windowtype_UV.jpg

  5. Click the Image button and choose Open.
  6. Navigate to the texture you want to use. Be sure that all the vertices are selected with the A Key and adjust your texture. Note: if you do not know about "Powers of Two for textures", do a search to learn more.

Note: You can either convert to triangles and then get the texture or you can get the texture and apply it and then split to triangles. In the first case the texture will go into the selected trianges. In the second case the picture goes into the selected polygon. I find that getting the textures right and then changing to triangles to be the most natural way to work in Blender. -- LightninBoy

Image:Example1.jpg Image:Example2.jpg

Export to COLLADA format


Follow these steps to export the model to COLLADA format:

  1. In the left window, click the Window type button and choose the Scripts Window.
  2. Click on the Scripts button and choose Export | Collada 1.4 (.dae).

    Note: If you do not see the interface below, but instead get an error, then you need to install Python. See Prerequisites.

  3. Image:Export.jpg


  4. Click Export and enter the name cubetutorial3.dae.

    Image:Namefile.jpg

  5. Click the Export.dae button. You will be returned to the first page.
  6. At the bottom of the plugin, click the Export button and it should report a success.

Convert to Multiverse format with Conversion Tool

To convert the COLLADA file you exported to Multiverse mesh format, follow these steps:

  1. Copy the Cubetutorial3.dae file into the directory containing the Multiverse Conversion Tool, by default, C:\Program Files\Multiverse Tools\Multiverse Model Viewer.
  2. Open a Windows Command Prompt window and enter the following command:
    cd C:\Program Files\Multiverse Tools\Multiverse Model Viewer
  3. Enter the following line in the Command Prompt window:
    ConversionTool cubetutorial3.dae 

Conversion Tool will convert the .dae file to Multiverse mesh format. Next you must edit the Material file for use in the Model Viewer.

Edit the Material File

Before you can see if the Conversion was a success you must edit the Material File with your favorite text editor. A good free editor is PSPad.

Edit the file C:\Program Files\Multiverse Tools\Multiverse Model Viewer\cubetutorial3.material and change it so that it looks as follows:

material cubetutorial3.UV_Test_jpg
{
    technique
    {
        pass
        {
            shading phong

            ambient  1.00000 1.00000 1.00000 1.00000
            diffuse  1.00000 1.00000 1.00000 1.00000
            specular 0.00000 0.00000 0.00000 1.00000 1.00000
            emissive 0.00000 0.00000 0.00000 1.00000
           
            texture_unit
            {
                texture UV_Test.jpg
                tex_coord_set 0
        }
    }
}

Now save and exit the editor.

Run the Model Viewer

Now you are ready to move the files to their proper folders. Put

  • cubetutorial3.mesh in C:\Assets\Meshes
  • cubetutorial3.material in C:\Assets\Materials
  • UV_Test.jpg in C:\Assets\Textures

Now Start Model Viewer and Designate Asset Repository and Start up the Model Viewer and Load the Model cubetutorial3.mesh and you should see the following cube sticking out of the ground.

Image:CubeAsset.jpg

Personal tools