====== Blender Model Export and UV Texturing (Blender 2.6) ====== Here are the steps required for exporting a textured object from [[http://www.blender3d.org|Blender3D]] to Panda3D. ===== Configuring Blender ===== - Take a look at the user preferences under **File->User Preferences...**. - Under the **Input** panel, notice that you can make is so that you **Select With** your left mouse button. **By default you select with the right mouse button**, which is quite unintuitive, so consider changing this. - Also, under this panel, you may want to choose **Turntable** as your **Orbit Style**, since that makes the 3D window work like a potter's wheel, keeping your objects steady on the horizontal plane as you rotate them. - When you are happy with how you have configured the Blender environment, use **File->Save User Settings** to make that configuration into the default configuration for Blender. ===== Getting and Installing Panda Exporter ===== - Download the ZIP archive of the latest version of the [[http://code.google.com/p/yabee/|YABEE Panda Exporter]] on Google code. - Run Blender and from **File->User Preferences...** choose the **Addons** panel and click the **Install Add-On** button. Navigate to and select your downloaded ZIP archive. - Once Blender has processed the ZIP file you should see the exporter listed, but grayed out. Check the check-box next to it to activate it. - Now you can run the exporter from the Blender File->Export menu. ===== Applying a Texture to an Object ===== - Select the cube (Left mouse button if you have changed the configuration, Right otherwise) - Name the selected object "Box" (press "n" for the "name" panel and type in "Box" under **Item**) - Now is a good time to save your Blender file, give it a name like "box.blend" and keep all your files for this model in the same folder - Switch to **Edit Mode** (The mode selector currently shows "Object Mode") - Switch to **Edge Select Mode** (Three buttons on the bottom bar of the window: vertex, edges and polys) - Multi-select (hold SHIFT) the "seam" Edges of the Box (for a fold-out cube) - **Mesh->Edges->Mark Seam** - Split main window (Drag the upper right corner of the 3D window to the left, revealing a second copy of the 3D window) - Select the **UV/Image Editor** view for new window from the view selector in the lower left corner of window - Select your object again in the 3D view (press "a" twice to select the whole object) - 3D Window: **Mesh->UV Unwrap->Unwrap** (you should now see the fold-out texture from the cube appear in the right UV/Image window) - UV Window: **UVs->Export UV Layout..** * And now you have a texture which you can edit in your favourite paint program (like [[http://www.gimp.org/|GIMP]], which is free!). Once you're done painting it, you can import it back into Blender like this: - UV Window: **Image->Open Image** (pick your file here and it is applied to your object) - To see it in the 3D Window, choose **Draw Type: Textured** from the **Draw Type** pop-up menu next to "Edit Mode" ===== Exporting the Textured Box ===== - Go into **Object Mode** and make sure your object is selected - Choose **File->Export->Panda3D (.egg)** - In the panel on the left, make sure to select **Simple** for the **Tex. process** and also check the **UV as Texture**. If you are keeping everything in the same folder, also uncheck the **Copy texture files** check box * You can now load the model like any other model with loader.loadModel("Box.egg")