how to bind several objects in 3DS Max into one objects

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
DJ Trauma
Gnoblar
Posts: 8
Joined: Sat Jul 02, 2005 8:38 pm
Location: Belgium

how to bind several objects in 3DS Max into one objects

Post by DJ Trauma »

Hi all. This'll be my first post here.

I've just downloaded the ogre exporter for 3DS Max. When using it, you must select one object to export. The problem is my scene (in 3D max) is build out of several objects. The question is: how can I make one object from them? I tried to group them but that doesn't seem to work.

Thx in advance.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Lioric
Google Summer of Code Mentor
Google Summer of Code Mentor
Posts: 295
Joined: Fri Aug 06, 2004 10:25 pm

Post by Lioric »

Ogre mesh file format can only have one mesh per file
Each mesh is composed of one or several submeshes, each submesh is determined by its material id

Probaly you can do a quick maxscript that iterate over your scene objects and export all of them, or you can wait a few weeks and use the new max exporter that its in beta testing right now :P

Lioric
DJ Trauma
Gnoblar
Posts: 8
Joined: Sat Jul 02, 2005 8:38 pm
Location: Belgium

Post by DJ Trauma »

Thx for your help guys, but it's still not working out to make it all into one object. I'll look around on 3ds max forums to see if I find some more info about this. Otherwise, I guess I'll have to wait for the new max exporter.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

BlasterN wrote:Attach all submeshes, and then convert to edit poly & then again to edit mesh.
You can undo this, if you - like me - want to continue editing your level.

If you find a better way of doing this, don't hesitate posting the solution here! :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
celic
Gnome
Posts: 363
Joined: Wed Mar 23, 2005 11:05 am
Location: Chisinau/Moldova
Contact:

Post by celic »

I have found almost the same solution, just without converting anything.

Simply attach all your objects from the scene/model in 3ds max, then if they are using different materials you will be asked to convert materials to material IDs, and viceversa.

The difference is:
in first case you'll get as many submeshes as many materials you have, in second - you'll have as many submeshes as many objects you have.
DJ Trauma
Gnoblar
Posts: 8
Joined: Sat Jul 02, 2005 8:38 pm
Location: Belgium

Post by DJ Trauma »

Attach all submeshes, and then convert to edit poly & then again to edit mesh.
How do I exactly 'attach all submeshes'? Is that the same as grouping?
User avatar
celic
Gnome
Posts: 363
Joined: Wed Mar 23, 2005 11:05 am
Location: Chisinau/Moldova
Contact:

Post by celic »

no, it's not the same as groupping.
it's an option from Edit Mesh modifier, if I remember.
you could select an object, then press attach list, and select the rest of the objects which you want to be attached.
Lioric
Google Summer of Code Mentor
Google Summer of Code Mentor
Posts: 295
Joined: Fri Aug 06, 2004 10:25 pm

Post by Lioric »

No, no, you are wasting rendering/processing resources if you convert all of your scene objects to one object, when the multiple objects are attached to form a single object, no matter if the created submeshes have different materials (in fact it will be better if all the materials can be baked on a single texture and you can have a single submesh, for porformance, i.e single rendering state change), with a single object, in this case your complete level objects, can't benefit from occlusion culling, because no matter if you are only rendering a few objects, if they are attached to the complete scene exported, then you will be rendering all the level meshes even when they are not in the fustrum, because you have converted to a single object.

The same happens for collision detection, lod optimization, lod materials

Lioric
DJ Trauma
Gnoblar
Posts: 8
Joined: Sat Jul 02, 2005 8:38 pm
Location: Belgium

Post by DJ Trauma »

I'm not trying to put my whole scene into one object. It's a building I designed out of separate blocks that I now want to convert into one object. I know that was probably a very bad way of building it, but my skills with 3DS Max are very very low.

I'm still looking on how to do this, but in the meanwhile I've found another problem. I watched that 3DS Max exporter flash tutorial and I saw that the author uses an Ogre Material exporter in 3DS Max. Now this is probably a very stupid question, but where can I find that material exporter? I only have the mesh exporter tool.
Gf11speed
Goblin
Posts: 242
Joined: Sat Mar 20, 2004 7:53 am
Location: Orlando, FL
x 1
Contact:

Post by Gf11speed »

To attach all objects into one object you must:

1) Highlight all meshes you want to merge.
2) Right click, hit convert to->editable mesh
3) Then deselect all meshes.
4) Select one of the meshes you want to merge
5) Right click on this message and hit Attach
6) Then click on the remaining messages to attach them to that mesh


That should make all the submeshes into one mesh.

The 3dsmax exporter comes with a material exporter I believe. So you can export it with that.
Coming soon...
DJ Trauma
Gnoblar
Posts: 8
Joined: Sat Jul 02, 2005 8:38 pm
Location: Belgium

Post by DJ Trauma »

Thanks! I finally succeeded to make one object from the submeshes. :D

About the material exporter, it does export the material successfull, but when converting the mesh.xml file into a .mesh file with the Ogre Mesh utility, it fails to load the materials.

I've put all the textures, the material file and the mesh.xml and .mesh file into the same folder. I also tried to edit the material file generated by the Ogre Mesh utility by replacing all info with the info generated by the material exporter. Still no luck though.

Don't know if this helps, but here is (a part of) the output of the Ogre Mesh viewer and the material script.

Ogre Mesh viewer log:
13:38:33: MeshSerializer export successful.
13:38:33: Destroying resource group MeshViewerGroup
13:38:33: Unloading resource group MeshViewerGroup
13:38:33: Finished unloading resource group MeshViewerGroup
13:38:33: Parsing material scripts
13:38:33: Creating resource group MeshViewerGroup
13:38:33: Added resource location 'C:\OgreSDK\building_test' of type 'FileSystem' to resource group 'MeshViewerGroup'
13:38:33: Initialising resource group MeshViewerGroup
13:38:33: Parsing scripts for resource group MeshViewerGroup
13:38:33: Parsing script buildingtestmaybedeleted.material
13:38:33: Finished parsing scripts for resource group MeshViewerGroup
13:38:33: End of material scripts parsing.
13:38:33: Mesh: Loading C:\OgreSDK\building_test\buildingtestmaybedeleted.mesh.
13:38:33: Can't assign material Material_#242/13_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/2_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/3_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/1_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/15_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/19_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/8_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/14_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/7_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: Can't assign material Material_#242/9_-_Default to SubEntity of C:\OgreSDK\building_test\buildingtestmaybedeleted because this Material does not exist. Have you forgotten to define it in a .material script?
13:38:33: MaterialSerializer : writing material Material_#242/13_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/2_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/3_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/1_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/15_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/19_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/8_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/14_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/7_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:33: MaterialSerializer : writing material Material_#242/9_-_Default to queue.
13:38:33: MaterialSerializer : done.
13:38:35: Texture: spot_shadow_fade.png: Loading 1 faces(PF_B8G8R8,128x128x1) with 5 generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
13:41:56: Added resource location 'C:\OgreSDK\building_test' of type 'FileSystem' to resource group 'MeshViewerGroup'
13:41:56: Initialising resource group MeshViewerGroup
My material script as generated by the ogre exporter:

Code: Select all



material Material #242/13_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture roof_tiles.jpg 
            }
        }
    }
}

material Material #242/2_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture concrete1.jpg 
            }
        }
    }
}

material Material #242/3_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture windows1.jpg 
            }
        }
    }
}

material Material #242/1_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture red_brick_wall.jpg 
            }
        }
    }
}

material Material #242/15_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture plastic_ridges.jpg 
            }
        }
    }
}

material Material #242/19_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture building1_3.jpg 
            }
        }
    }
}

material Material #242/8_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture concrete2.jpg 
            }
        }
    }
}

material Material #242/14_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture concrete3.JPG 
            }
        }
    }
}

material Material #242/7_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture windows3.jpg 
            }
        }
    }
}

material Material #242/9_-_Default
{
    technique
    {
        pass
        {
            ambient 0.588235 0.588235 0.588235
            diffuse 0.588235 0.588235 0.588235
            specular 0.9 0.9 0.9 0.0
            emissive 0.0 0.0 0.0
            texture_unit
            {
                texture concrete2.jpg 
            }
        }
    }
}
User avatar
celic
Gnome
Posts: 363
Joined: Wed Mar 23, 2005 11:05 am
Location: Chisinau/Moldova
Contact:

Post by celic »

you should add just an "_" symbol to the material name:
material Material #242/13_-_Default
should be renamed to
material Material_#242/13_-_Default
[/code]
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

DJ Trauma wrote:About the material exporter, it does export the material successfull, but when converting the mesh.xml file into a .mesh file with the Ogre Mesh utility, it fails to load the materials.
You will get much better results if you in Max go to the material editor and use OGRE materials.
Remember to name your materials, otherwise you will get those weird default material names. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
DJ Trauma
Gnoblar
Posts: 8
Joined: Sat Jul 02, 2005 8:38 pm
Location: Belgium

Post by DJ Trauma »

Yeehaa! It works! :D

Thanks so much for all your help people. This is one of the few forums I know where I get so much quality help in such a short time. Just great!
Post Reply