Blender to Sandbox
Part I: Setup and installation.
For this tutorial you will need 3 things.
- Blender: http://www.blender.org/download/get-blender/
- Python: http://python.org/download/
- Md3 export script: http://johnny3d.promail.ca/wikitut/blendermd3_updated.zip
What to do:
- Download and install both blender 2.49b as well as Python 2.6.4. Also download and extract blendermd3_updated and save somewhere you will remember.
- Open blender and check the console window. Make sure it has found you're python installation as it is needed for the export script to work properly. It should look something like the image below. http://www.sigmirror.com/files/50171_mxqlo/Testing_console_3.jpg
Part II: Setting up the model and texture in blender.
Note: some users who are familiar with other 3d software may want to go into blenders user preferences and change the view rotation to turntable and around selection.
Here is a link explaining what I mean. http://www.scribd.com/doc/10082639/Essential-Blender-14-Preferences-and-Options
- Go into front view by pressing 1 on the numpad or Go to view > Front from the menu.
- Press Tab and go into edit mode. http://forum.sandboxgamemaker.com/download/file.php?id=136&t=1
- While holding ctrl, move the box up with with the blue handle so your cube sits flush with the grid. This ensures that when you add the model in sandbox, it is not sitting through the ground in it's default position. http://forum.sandboxgamemaker.com/download/file.php?id=137&t=1
- Now we're going to split up our view to include a UV/Image Editor window, so we can unwrap our UVs and see what the model will eventually look like in game. http://forum.sandboxgamemaker.com/download/file.php?id=138&t=1
Here is a link explaining how to split your views. http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Blender_Windowing_System
- Now while still in edit mode, make sure your cursor is within the 3d viewport and press U on your keyboard. Click unwrap and your uvs should be ready to go. http://forum.sandboxgamemaker.com/download/file.php?id=139&t=1
- Now we'll apply an image to our uvs. You can use whatever image you would like, I'm going to use the image below.
http://www.dougturner.net/blendersite/images%5CTextures%5Cstore%5C1_store.jpg
- Go to Image > Open within the uvimage editor and select your image. Also change the drawtype to textured in your 3d window.
We are now ready for export. Press Tab and go back into Object mode. Rotate around your model with middle mouse button or alt and mouse button 1 to ensure all looks well. http://forum.sandboxgamemaker.com/download/file.php?id=140&t=1 http://forum.sandboxgamemaker.com/download/file.php?id=141&t=1
Part III: Exporting and writing your md3.cfg
- First lets create a new directory within /packages/models of your Sandbox installation. For this example I will just create a new folder called box.
- Now change the uvimage editor into a text editor. Browse to where you extracted the export scripts and open md3_export_test2.py.
- Make sure your object is selected, and with your cursor in the text editor workspace, press alt + p on your keyboard to execute the script.
- Save as tris.md3 within /packages/models/box
http://forum.sandboxgamemaker.com/download/file.php?id=142&t=1
http://forum.sandboxgamemaker.com/download/file.php?id=143&t=1
Note : If you get an import md3 error while trying to export from blender's text editor, try doing this.
- Alternatively to loading the export script through the text editor, you can copy all the .py files within the blendermd3_updated archive to your /.blender/scripts/blender folder.
- After doing so you should see .md3 under file > export. Makes for a simple and quick export process. You need to enable view of hidden folders in windows explorer, and the path to this directory may be different depending on which windows OS you're using and/or how blender was installed. Both links below should be helpful in finding that path.
http://www.katsbits.com/htm/tutorials/blender_useful_keyboard_shortcut_keys.htm
http://www.blender.org/forum/viewtopic.php?t=14442&view=previous&sid=0eebb94ea37c3678ffb82adf48a2c3e5
- Copy your texture over to this directory and right click > create a new text file. Once again right click and edit with your favorite text editor.
- Windows users can just use wordpad. Don't use notepad as it won't save formatting.
Here is my config, You can just copy and paste this in your text file. Now save as md3.cfg
Note: the line md3skin Cube - Cube refers to whatever your object was named in blender.
//load model md3load tris.md3
//skin model md3skin Cube 1_store.jpg
//increase scale mdlscale 2000 //turn off specularity mdlspec -1