Single Mesh / Multiple Mesh files for 1 Entity

tlc

17-03-2008 07:38:09

Dear all, not sure which forum category I should ask this question:

Currently I have a very complex ship 3D model (loaded in 3dsmax), when I exported it out using oFusion, it gives multiple mesh files (at least 30 of them).

I would like to implement this ship object with collision detection as it moves. How do I group these mesh files as one so that I can regard it as 1 single entity (using CreateEntity function)?

In all previous demo examples, it only have 1 mesh file for 1 entity. Anyone can help?

Rgds,
TLC

dbrock

17-03-2008 16:14:03

You could use meshmagick, and tie in all the meshes into a single mesh file.

A merging example:

meshmagick meshmerge input1.mesh input2.mesh input3.mesh -- output.mesh

Evak

17-03-2008 20:52:53

You could just attach them all in max to make a single mesh, if you don't need it to be in parts. If you need it in parts held together so you can move the ship as a whole you can link them as a heirarchy. and save out an OSM scene.

The way we handle collisions is to make low poly proxy meshes for each seperate mesh that needs custom collision, make sure they are aligned correctly with the visual mesh, and the local pivot is in the correct place. We name the collision mesh the same as the visual mesh only with a _COL postfix in the name.

when you run the game, the engine checks the resources and automaticly loads all the _Col versions at the same position as the visual mesh.

we have dynamic and static collision types.

Were using the scene loader library to load gameplay objects, and ofusion pro. I think Ofusion CE allows basic heirarchy linking, but not helper nodes. so you should be able to save out your ship in its own scene with a parent anchor node that holds it all together. Move the anchor and the whole ship will move with it.

You can load as many OSM scenes as you like into your basic level scene. The only thing to watch out for is if you have a lot of ships made up of 30 dynamic objects things will start to slow down because of the large batch count being processed by the GPU.

Hard to tell what the best solution for your problem is because it depends a lot on what you need your ship to do in your application.

tlc

18-03-2008 06:44:57

You could use meshmagick, and tie in all the meshes into a single mesh file.

A merging example:

meshmagick meshmerge input1.mesh input2.mesh input3.mesh -- output.mesh


Thanks! But when I use, I have errors indicating that many mesh files does not have skeletons and the merging failed. Why is it so?

tlc

18-03-2008 06:59:17

You could just attach them all in max to make a single mesh, if you don't need it to be in parts. If you need it in parts held together so you can move the ship as a whole you can link them as a heirarchy. and save out an OSM scene.

Thanks Evak! I did that attached ALL in the 3dsmax for my ship & now oFusion exported it as one single mesh file. As for texture files, will they be corrupted?

The way we handle collisions is to make low poly proxy meshes for each seperate mesh that needs custom collision, make sure they are aligned correctly with the visual mesh, and the local pivot is in the correct place. We name the collision mesh the same as the visual mesh only with a _COL postfix in the name.

Sorry I don't quite understand what you are writing. How to create a low poly proxy meshes and how to align them to the visual mesh. Am I right to say that proxy meshes are invisible, while visual meshes are visible?

when you run the game, the engine checks the resources and automaticly loads all the _Col versions at the same position as the visual mesh.

Do you have any sample code for the above mentioned?

we have dynamic and static collision types.

Yes, currently the game I'm creating have both dynamics (ships) and static object (beacon, lighthouse, etc).

Were using the scene loader library to load gameplay objects, and ofusion pro. I think Ofusion CE allows basic heirarchy linking, but not helper nodes. so you should be able to save out your ship in its own scene with a parent anchor node that holds it all together. Move the anchor and the whole ship will move with it.

What is oFusion CE? Is it the same as the oFusion plugin for 3dsmax?

You can load as many OSM scenes as you like into your basic level scene. The only thing to watch out for is if you have a lot of ships made up of 30 dynamic objects things will start to slow down because of the large batch count being processed by the GPU.

If I have OSM scenenode, what collision body should I use? TreeCollisionPrimitives are for static object. If I move it as I change the scenenode position, will the collision work?

Lioric

19-03-2008 04:08:53

Your textures and materials wont be affected when you attach your objects (select the options that suit your needs when the material ID dialog is displayed)

How you create your proxies is very specific on your project, some create low poly versions of the object (when more resolution is needed by your system), or you can use primitives that match the shape of the object (and on some specific cases splines are used)

Yes, the proxy object is not visible and the mesh is, but you create them and at load time you use its information (project specific) you can extract the vertices or use the AABB

After this, you can hide them or do what your project needs

To align an object to another, use the Align tool

If you are using the Scene Loader library, use the event system to be notified when any entity is loaded, your application will get the loaded Entity pointer and you can use this to load the proxy object, as noted above, you can get the name of the entity and add a standarized string, and use this value to load the proxy mesh

If you entitiy is named "ship01" and you created and exported with a proxy object for it with a "ship01_proxy" name, when the ship01 entity is loaded you can add "_proxy" to its name and use it to load your proxy object

Other method is to link the proxy object to its visual mesh and export the scene, when loading you can access this proxy object as a child of the "ship01" object

There are several methods, and wich method you use will be mostly application specific, but is simply as selecting a sensible method for your project and standarize it over your entire project

For sample of using the event system to get specific notifications when loading your scenes, see the oSceneLoader demo application