Page 1 of 2

3DS Max Exporting

Posted: Sun Feb 15, 2009 10:50 pm
by Psych
There's alot of threads about this, but not any that I understood.

Is there a plug-in for 3DS9 that exports the files I need to work with PB 4.2? (.mesh, .skeleton, the animations and the image for the skin)

I tried the 'Freexporter' (http://sourceforge.net/projects/freexporter/) but 3DS9 fails to initialise it, so I cannot export with it.

Any ideas?

Posted: Sun Feb 15, 2009 11:08 pm
by Mistrel
.3ds is a mesh format that pre-dates bone support in 3dsmax. If you're using DirectX then .x is the optimal format. Formats supported by other engines may vary.

If you want to consider a alternative format try .fbx (universal and widely supported by all major 3D packages) or Collada (open-source xml format but not well supported).

.3ds is archaic and from if I remember correctly different exporters don't always adhere to the format standards and may require tweaking to import properly. For additional information about the .3ds format see here:

http://www.martinreddy.net/gfx/3d/3DS.spec

Other sources:
http://www.whisqu.se/per/docs/graphics56.htm
http://www.the-labs.com/Blender/3DS-details.html

Posted: Sun Feb 15, 2009 11:18 pm
by Psych
Thanks, my brother uses these when programming using DirectX in C (more .x than .fbx tho).
The .fbx would be prefered as all the images, etc are embedded, meaning 1 file for 1 entity.
The .x or .fbx files however cannot be used directly with ogre for PB (I think), so I need a converter or a 3DS9 plugin that outputs the mesh etc.
If I can use the .x or .fbx files in PB then problem solved!!
I am new to al of this, so excuse my lack of knowledge on these matters, lol.

Posted: Sun Feb 15, 2009 11:21 pm
by Mistrel
If Ogre doesn't support these formats then you'll have to convert it yourself. There are also Ogre .xml exporters for 3dsmax. Once you have the xml run it through the binary compiler included with the Ogre command-line tools to get an import-able format.

Posted: Mon Feb 16, 2009 9:38 am
by Kelebrindae
I use OgreMax to export from 3DS Max 9 to PB :

http://www.ogremax.com/

BUT:
- I have to export the meshes to XML files then convert them to binary using ogreXmlConverter (a command-line tool; just drag-n-drop the XML file on the exe in the explorer to get the binary ".mesh" file); strangely, if I export directly to binary in OgreMax, I get a much smaller file that PB can't read...
- I still can't export meshes with skeletal animations. (Well, I can export them, but PB can't load them afterwards... :wink: )

I've asked about this issues in the OgreMax forums two weeks ago, but there's no answer yet...

I should try oFusion, but it looks like a bit of an overkill...
http://www.ofusiontechnologies.com/

Posted: Mon Feb 16, 2009 12:03 pm
by Mistrel
A lot of good information there, Kelebrindae. Thanks for clarifying. :)

Posted: Mon Feb 16, 2009 1:14 pm
by Psych
Ok, the problem I had using the exporter in the first link was that I didn't have the latest DirectX runtimes, once you install these (from microsoft) the exporter initialises.
I've not tested the meshes etc yet, but I did export a small sphere from 3DS Max and all the files were exported in the correct formats (the extensions matched).
I'll test whether they render correctly in PB when I get home today.

Posted: Mon Feb 16, 2009 5:22 pm
by Kelebrindae
Thanks, Mistrel! :)

@Psych:
I have to thank you, Psych.

I was stuck in OgreMax, not knowing how to export animations, and I was waiting for an answer in the OgreMax forums.
But this morning, after answering your post, I finally installed oFusion and tried to export a simple mesh rigged and animated with just two bones (no biped, no Skin or Physique).
=> And it works! :D

It's quite easy:
- In 3DSmax, create your mesh, texture it, rig and animate it, etc..
- Menu "oFusion", select "Export scene...";
- Enter a name for the scene;
- Uncheck "scene file", check "export animations", check "copy textures", and check "Generate Lods" if you need;
- Add the animations to export in the list;
Image
- Click "Export".

And voila! You get the ".mesh" files for the mesh and the bones, the ".skeleton" file, the ".material" file, and a copy of the texture file in the target directory. Now, you just have to load the mesh in PB.

I have to investigate a little further (with multiple material layers, biped + skin/physique animations, etc.), but it seems to work fine.

:D [doing a little victory dance] :D

Posted: Mon Feb 16, 2009 10:46 pm
by Psych
Ok, in PB you cannot import .material files (at least I dont think you can), the way I understand it you need the image file for the skin and create the texture for the mesh that way, so how do you get this image file?
I have an object (just a ball) and I want to use that in PB, now I can export the .mesh no problem, but what about the skin?
Do I need a .material to JPEG converter or something?

Posted: Mon Feb 16, 2009 11:49 pm
by Anonymous
Parse3DScripts() ? no ?

Posted: Tue Feb 17, 2009 12:05 am
by Psych
That should work, and excuse my ignorance for not trying that sooner, however it doesnt, maybe I have the wrong version installed, either way it is beginning to frustrate me.
If the robot mesh initialises, why not my little sphere?
Do the filenames have to match? eg. Ball.mesh, Ball.material?

Posted: Tue Feb 17, 2009 12:16 am
by Mistrel
Kelebrindae, when I worked on an Ogre project I used the MaxScript exporter. I don't remember if I used Physique or Skin but it did export Biped just fine.

Posted: Tue Feb 17, 2009 9:28 am
by Kelebrindae
@Mistrel:
Thanks, I'll take a look!

@Psych:
I think that the name of the material is stored in the ".mesh" file; you can find it there if you export to XML.

Here's how I proceed to load an exported mesh:
- First, you parse the material files with "Parse3DScript"
- Then, you load the mesh
- You create the entity from the mesh

This code should do the trick:

Code: Select all

Add3DArchive([Path to your ".material" file], #PB_3DArchive_FileSystem)
Parse3DScripts()
LoadMesh(1, [your ".mesh" file])
CreateEntity(1, MeshID(1), #PB_Material_None)
You can see how it works in this example from Djes in the french forum:
http://www.purebasic.fr/french/viewtopic.php?t=8717
http://djes.free.fr/purebasic/OgreMeshesLibrary.zip

Posted: Tue Feb 17, 2009 9:33 am
by djes

Posted: Tue Feb 17, 2009 1:55 pm
by Psych
Okay, there is something wrong with the mesh, because it is telling me the mesh is not initialised (it's not loading correctly).
Maybe it's a mesh exporting issue, or I am not doing something when I create them.