[GUIDE] Blender exporting for Pseudoform

People who lost their manual can get a replacement here.

[GUIDE] Blender exporting for Pseudoform

Postby Eriksrocks » 11 Aug 2009, 21:52

Creating objects using Blender

This is a brief tutorial on exporting meshes from the Blender 3D modeling program into Pseudoform for use as props or levels. All instructions apply to Windows, Mac OS X, and Linux unless otherwise specified. :)

1. Preparing your computer

Blender is a great free, open-source, multi-platform 3D modeling program. In order to follow this tutorial you'll need a recent version of Blender as well as a recent version of Python for some of Blender's features and the Ogre Exporter that is described below.

This tutorial is written for Blender 2.49 and it won't work like that for 2.5 or later. You should grab the latest version of Python in the 2.x series (Blender 2.49 uses Python 2.x, Blender 2.5 uses 3.x which isn't code compatible).
This tutorial was tested for Blender 2.49a and Python 2.6.2, and everything is worked fine. Once 2.5 is being stable and the Ogre Exporter is available for it, this guide is going to be updated.

For Windows and Mac OS X users:
You can download Blender here:
http://www.blender.org/download/get-blender/

You can download Python here:
http://www.python.org/download/

When installing Blender, remember the chosen location of the user data directory - you'll need that information later.

For Linux users:
Install Blender and Python from your package repository. If you don't know how to do that, refer to the documentation if your Linux distro.

Note: This tutorial covers the basics of exporting models in Blender for use in Pseudoform. Things like modeling, texturing, UV mapping, etc. are not covered here. If you are new to modeling and/or Blender and want to learn more about modeling and using Blender before continuing, I highly recommend you read the Blender 3D: Noob to Pro wikibook found here.

2. Getting the Ogre exporter and OgreXMLConverter

Ogre is the 3D engine Pseudoform uses so we need to export our meshes in its mesh format. To be able to export such meshes with Blender, you'll first need to download the Ogre Meshes Exporter: (Zip | SVN)

Once you've downloaded and extracted it, copy ogremeshesexporter.py and subfolders to the path [user data directory]\blender\.blender\scripts where [user data directory] is the location that you chose during installation.

Note for *nix users: A dot at the beginning of a filename as in .blender indicates on unix-like systems that it should be hidden. You should be able to configure you file browser to show such files. The ls command will show them if you use the -a option.

In addition to the Ogre Meshes Exporter we need an Ogre command line tool, OgreXMLConverter, to convert the XML files produced by the Ogre Meshes Exporter into binary .mesh files that can be used in Pseudoform. If you already have Ogre installed you should have it already. Otherwise, you'll need to download and install it.

Instructions for Windows and Mac OS X users:

Download and extract the Ogre Command-line Tools download: (Win | Mac) Extract/install everything to wherever you want, just remember the location for later.

Instructions for Linux users:

You should be able to obtain an "Ogre Tools" package through your package manager. Remember the location of OgreXMLConverter for use later.

3. Using the exporter

Blender's interface is managed through areas. You can arrange them by pulling their borders and right clicking them:

Image

On the left of every area's header, you can select its type on the buttons marked in the picture. As default there are three areas: The "User Preferences" containing the main menu and the options (enlarge it to see them), the "3D View" and the "Buttons Window".

When you've loaded the project containing the mesh you'd like to export, select the object/mesh that you want to export and then go to File ? Export ? OGRE Meshes.

Image

Once you've done that, you'll see the exporter's interface:

Image

For now, deselect Export Materials. We will be using a material template and manually editing that so we don't need the exporter to generate a material file for us. Also select Fix Up Axis to Y. In Blender the up axis is Z, but in Pseudoform the Y axis is "up." If you don't do this your props and models will come out sideways!

The exporter exports Ogre .xml meshes but we need .mesh files. Click on OgreXMLConverter to activate it and make the exporter automatically convert to .mesh. Then click on Preferences which will bring you to the settings window for the OgreXMLConverter:

Image

Click on Manual and then click on Select to specify the path to the converter. (If you don't have it installed, go back to step 2.) Then click Ok.

To export your mesh, make sure you've selected it, choose a path into which you want it to be placed and then press Export.

Image

You should see a screen with the export log. If there are no errors, you're golden! On to the next step!

4. Getting your mesh into Pseudoform

This can be the tricky part, depending on how complex your object is and what sort of materials you have. To get you started I have prepared a level template that you can use and modify to your needs. Start by downloading and extracting level_template.zip to the /data/levels directory of your Pseudoform installation. Then open level_template.material with the text editor of your choice.

First change level_template_mat to fit the name of your level. So if your level was named "mylevel," you would change it to something like mylevel_mat. Remember this name for use later.
Next, change the diffuseMap path to the path of your diffuse map texture, relative to the Pseudoform data directory. Here, it points to a 512 x 512 wood texture that was UV mapped in Blender. (For reference, texture palettes that you use in your levels should either be 2048 x 2048 or 4096 x 4096, PNG format.)
Finally, change the normalMap path to your normal map texture (if you have one), relative to the Pseudoform directory. If you aren't using a normal map, comment this line out by inserting two forward slashes (//) at the beginning.

We'll leave the aoMap and emissiveMap paths commented out for now because they are still being worked on. If you know what you're doing, go ahead and try them. This tutorial may be updated in the future to cover AO maps and emissive maps.

Syntax: [ Download ] [ Hide ]
Using cpp Syntax Highlighting
import normal_map_template from "media/shaders/general.material"

material level_template_mat : normal_map_template
{
    set_texture_alias diffuseMap levels/level_template/template_d.png // Your diffuse map texture goes here!
    //set_texture_alias aoMap levels/test_ao2/test_ao2_a.png // Pre-baked AO is still a WIP, so we're not going to mess with it for now.
    //set_texture_alias emissiveMap media/textures/teapot_e.png
    set_texture_alias normalMap media/textures/noisy_n.jpg // Your normal map texture goes here!
}
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


Save and close the material file and then open up level_template.prop using a text editor. This is very simple. Just change both mesh attributes to point to the path of your .mesh file (relative to the Pseudoform data directory) and change the material attribute to the name of the material you specified earlier.

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
<prop>
    <gfx mesh="levels/level_template/level_template.mesh" material="level_template_mat"/>    <phys type="tree" mesh="levels/level_template/level_template.mesh" mass="0"/></prop>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


That's it! You're done! Save and close the prop file, then fire up Pseudoform, press F1 to bring up the props menu, and click on the thumbnail of your level to load it. Add more props, portals, lights, triggers, whatever else you need in your level, and then click on the save button to save it as a .lvl file.

Once you're done with that, you're finished. Your level is ready to be shared with the world!

5. Tips

  • The exporter will ignore the rotation and transformation of your objects. Use Object ? Clear/Apply ? Apply Size/Rotation in the 3D View or press Ctrl+E to apply it to the vertex data.
  • If you've done the above and still have levels that are either way too big or way too small, remember that one Blender Unit (BU) is equal to one meter when exporting into Pseudoform. A medium sized level will be anywhere between 20-75 meters or BU in each dimension.
  • By adding more and more window areas, they might not fit their content anymore. For the Buttons Window, you can correct this by moving its contents using the middle mouse button, and/or zooming in and out using the + and - buttons on the numpad.
  • If you want to learn more on how to use Blender, take a look at the Blender 3D: Noob to Pro wikibook found here.

Note: If you notice any errors or discrepancies in this tutorial, or would like to suggest improvements, post a repy to this thread. Thanks.

Updates
  • 31 Dec. 09, JoR: Blender 2.5 Alpha is released, 2.49 Scripts won't work anymore, The whole UI was rewritten so the guide won't work for it like that. We should update it once it works. Added Updates section.
Erik

OS: Windows Vista Home Premium / openSUSE 32-bit; CPU: Intel Pentium 4 2.8 GHz; RAM: 1.5GB DDR; Graphics card: ATI Radeon HD 2600 XT.
OS: Windows XP MCE; CPU: Intel Pentium D 805 2.66 GHz; RAM: 3GB DDR2; Graphics card: Nvidia 8800 GT 512MB OC.
User avatar
Eriksrocks
Tester
Tester
 
Posts: 465
Joined: 13 Aug 2008, 05:59

Re: [GUIDE] Blender exporting for Pseudoform

Postby ColeScheffler » 23 Sep 2009, 23:30

Okay, I finally get to ask...

How will we get textures on our models? :)

Great tutorial by the way! :D
Gaming: OS: Windows 7 64-bit, Ubuntu x86_64 with KDE 4.3; CPU: Intel Core2Duo e8400 @ 3.5Ghz; RAM: 4GB DDR2; GPU: XFX 9800GT.
Mobile: OS: Windows XP 32-bit, Linux (soon); CPU: Intel Atom N270 @ 1.66GHZ; RAM: 1GB DDR2; GPU: Intel GMA 950.
User avatar
ColeScheffler
Intermediary Appearance
Intermediary Appearance
 
Posts: 151
Joined: 28 Jun 2009, 20:58
Location: Harlan, Iowa

Re: [GUIDE] Blender exporting for Pseudoform

Postby LUC4S » 23 Sep 2009, 23:34

ColeScheffler wrote:Okay, I finally get to ask...

How will we get textures on our models? :)

Great tutorial by the way! :D


You can learn almost anything about blender in here:

http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro

To learn about textures, try this one:
http://en.wikibooks.org/wiki/Blender_3D ... g_Textures
5 Windows, 5 differens specs.
Newest computer last upgrade: 10/07/09
Oldest computer last upgrade: ??/??/1992 ಠ_ಠ
User avatar
LUC4S
Temporary Appearance
Temporary Appearance
 
Posts: 27
Joined: 04 Aug 2008, 19:45

Re: [GUIDE] Blender exporting for Pseudoform

Postby ColeScheffler » 23 Sep 2009, 23:36

LUC4S wrote:
ColeScheffler wrote:Okay, I finally get to ask...

How will we get textures on our models? :)

Great tutorial by the way! :D


You can learn almost anything about blender in here:

http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro

To learn about textures, try this one:
http://en.wikibooks.org/wiki/Blender_3D ... g_Textures

I know that, but I'm talking about once they are in-game.
Gaming: OS: Windows 7 64-bit, Ubuntu x86_64 with KDE 4.3; CPU: Intel Core2Duo e8400 @ 3.5Ghz; RAM: 4GB DDR2; GPU: XFX 9800GT.
Mobile: OS: Windows XP 32-bit, Linux (soon); CPU: Intel Atom N270 @ 1.66GHZ; RAM: 1GB DDR2; GPU: Intel GMA 950.
User avatar
ColeScheffler
Intermediary Appearance
Intermediary Appearance
 
Posts: 151
Joined: 28 Jun 2009, 20:58
Location: Harlan, Iowa

Re: [GUIDE] Blender exporting for Pseudoform

Postby LUC4S » 23 Sep 2009, 23:39

I think there's going to be a especific folder for textures one for props and one for mesh, so you can name them the same and those would magically transform themselves into the object?
5 Windows, 5 differens specs.
Newest computer last upgrade: 10/07/09
Oldest computer last upgrade: ??/??/1992 ಠ_ಠ
User avatar
LUC4S
Temporary Appearance
Temporary Appearance
 
Posts: 27
Joined: 04 Aug 2008, 19:45

Re: [GUIDE] Blender exporting for Pseudoform

Postby ZomBuster » 25 Sep 2009, 16:47

Mhh sounds good

Now hurry up with the releasing the game so people can use this
OS: Windows 7 Ultimate 32-bit; CPU: AMD x2 5600+ 2.8 Ghz; RAM: 2GB; Graphics card: Nvidia 9600 GT 512MB (185.81)
User avatar
ZomBuster
Void Appearance
Void Appearance
 
Posts: 7
Joined: 04 Aug 2008, 22:48

Re: [GUIDE] Blender exporting for Pseudoform

Postby LUC4S » 27 Sep 2009, 19:25

Whoa, that looks really hard. I hope they implant an importing system.
5 Windows, 5 differens specs.
Newest computer last upgrade: 10/07/09
Oldest computer last upgrade: ??/??/1992 ಠ_ಠ
User avatar
LUC4S
Temporary Appearance
Temporary Appearance
 
Posts: 27
Joined: 04 Aug 2008, 19:45

Re: [GUIDE] Blender exporting for Pseudoform

Postby shua » 08 Oct 2009, 02:14

by one blender unit, do you mean that the cube in the startup would be 200x200x200 meters?!
>+++++++++[<+++++++++>-]<++.>>++++++++++[<++++++++++>-]<++++.>>
Desktop OS: Linux Mint 8 "Helena" 64bit; CPU: AMD Athlon II; RAM: 4Gb; Graphics: NVidia GeForce 9500 GT 1Gb
Mobile(/ish) OS: archlinux 2009_8; CPU: intel pentium 4; RAM: 512Mb; Graphics: integrated ATI Radeon IGP 340M (Mobility U2)
Virtualbox: archlinux 2009_8, Windows 7 64bit Access to: Windows XP, sometimes vista, and maybe osx

+++++++++++[<+++++++++++>-]<----.>>++++++++++[<++++++++++>-]<---.
User avatar
shua
Intermediary Appearance
Intermediary Appearance
 
Posts: 130
Joined: 07 Aug 2009, 16:19
Location: America

Re: [GUIDE] Blender exporting for Pseudoform

Postby Isidor3 » 08 Oct 2009, 22:12

No, the default blender cube is 2x2x2m
Primary System:
CPU: AMD Athlon 64 X2 Dual core 6000+ 3.11Ghz Ram: 4Gb (only 3.11Gb used by windows, due to it being 32bit) OS: Windows XP pro 32bit Video Card: integrated ATI Radeon HD 3200 (512mb of Vram, shared with system)

Secondary System
CPU: Intel Pentium 4 2.4Ghz with hyperthreading RAM: 2.5Gb OS: Windows XP home 32bit Video Card ATI Radeon 1300x pro, 512mb Vram
User avatar
Isidor3
Void Appearance
Void Appearance
 
Posts: 8
Joined: 08 Aug 2009, 01:37
Location: USA

Re: [GUIDE] Blender exporting for Pseudoform

Postby Svenstaro » 09 Oct 2009, 13:25

LUC4S wrote:Whoa, that looks really hard. I hope they implant an importing system.


Can you give me an example of an easy import system for any current game?
OS: Windows 7 64bit / Arch Linux x86_64; CPU: Intel Core Quad 3.2 Ghz; RAM: 8GB; Graphics card: Nvidia 8800 GTX 768MB
Portalized Steam Community Group
User avatar
Svenstaro
Developer
Developer
 
Posts: 820
Joined: 28 Apr 2008, 22:34
Location: Germany

Re: [GUIDE] Blender exporting for Pseudoform

Postby Ratfink » 09 Oct 2009, 14:59

Not that I can think of, which is why if you made one here it would make this game much more special.
OS: Fedora Linux 11 32bit; CPU: Pentium 4 dual core 3 Ghz; RAM: 1GB; Graphics card: Nvidia GEForce 6200
OS: Fedora Linux 12 32bit; CPU: Intel Core 2 Duo 3.33 Ghz; RAM: 2GB; Graphics card: Nvidia GEForce 8800
User avatar
Ratfink
Transient Appearance
Transient Appearance
 
Posts: 75
Joined: 09 Aug 2009, 02:34

Re: [GUIDE] Blender exporting for Pseudoform

Postby Phosfor » 09 Oct 2009, 15:19

If you did it one time it is very easy... I don't realy know what you can make more easy there without loosing too much control of s.th.

But I would realy like if there where a possibility to apply the textures you had in Blender without having to use UV-mapping.
But I know that this is not possible becouse you're using Ogre.
OS: Windows Vista 32bit / Ubuntu 64bit;
CPU: Intel Core 2Duo: 2.66 Ghz;
RAM: 4GB;
Graphics card: Nvidia Geforce 8600GS 256MB
User avatar
Phosfor
Intermediary Appearance
Intermediary Appearance
 
Posts: 141
Joined: 16 Aug 2009, 12:57
Location: Germany

Re: [GUIDE] Blender exporting for Pseudoform

Postby shua » 10 Oct 2009, 03:58

well in blender if you keep zooming in it will split one blender unit block into 10ths then split those 10ths of a unit into 100ths of the original BU, that's what was throwing me off thanks Isidor.
>+++++++++[<+++++++++>-]<++.>>++++++++++[<++++++++++>-]<++++.>>
Desktop OS: Linux Mint 8 "Helena" 64bit; CPU: AMD Athlon II; RAM: 4Gb; Graphics: NVidia GeForce 9500 GT 1Gb
Mobile(/ish) OS: archlinux 2009_8; CPU: intel pentium 4; RAM: 512Mb; Graphics: integrated ATI Radeon IGP 340M (Mobility U2)
Virtualbox: archlinux 2009_8, Windows 7 64bit Access to: Windows XP, sometimes vista, and maybe osx

+++++++++++[<+++++++++++>-]<----.>>++++++++++[<++++++++++>-]<---.
User avatar
shua
Intermediary Appearance
Intermediary Appearance
 
Posts: 130
Joined: 07 Aug 2009, 16:19
Location: America

Re: [GUIDE] Blender exporting for Pseudoform

Postby Eriksrocks » 10 Oct 2009, 07:12

When Blender 2.5 is released I plan to update this with clarification on common problems and hopefully a full guide to texturing. :)
Erik

OS: Windows Vista Home Premium / openSUSE 32-bit; CPU: Intel Pentium 4 2.8 GHz; RAM: 1.5GB DDR; Graphics card: ATI Radeon HD 2600 XT.
OS: Windows XP MCE; CPU: Intel Pentium D 805 2.66 GHz; RAM: 3GB DDR2; Graphics card: Nvidia 8800 GT 512MB OC.
User avatar
Eriksrocks
Tester
Tester
 
Posts: 465
Joined: 13 Aug 2008, 05:59

Re: [GUIDE] Blender exporting for Pseudoform

Postby Svenstaro » 10 Oct 2009, 15:59

Phosfor wrote:If you did it one time it is very easy... I don't realy know what you can make more easy there without loosing too much control of s.th.

But I would realy like if there where a possibility to apply the textures you had in Blender without having to use UV-mapping.
But I know that this is not possible becouse you're using Ogre.


You can do it using submeshing BECAUSE we are using Ogre. Basically, just select the faces you want the texture applied to, apply the texture (all this in Blender still) and do so for all surfaces with different materials. The Blender exporter will then dissect your mesh automatically according to materials. Another way is using automatic texture baking from Blender.
OS: Windows 7 64bit / Arch Linux x86_64; CPU: Intel Core Quad 3.2 Ghz; RAM: 8GB; Graphics card: Nvidia 8800 GTX 768MB
Portalized Steam Community Group
User avatar
Svenstaro
Developer
Developer
 
Posts: 820
Joined: 28 Apr 2008, 22:34
Location: Germany


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron