Advanced Question Is there an easy way to combine orbiter meshes?

jimd

New member
Joined
Mar 30, 2009
Messages
25
Reaction score
0
Points
0
I am working on a Multistage2 add-on and have come across a curious problem. The add-on I am making is actually based on 3 existingt elements stacked on top of each other as a payload.

Based on what I have seen done by others it seems that the way to do this is to create a temporary mesh out of the existing elements stacked together. Going this way allows the jettison process to look visually correct.

Is there an easy way (not using a 3d program) to stack individual meshes on top of one another to create a single larger mesh?
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
If meshes of stages are already shifted inside of .msh files, you can just copy mesh groups from all the stages to one file by using a text editor, material and texture entries too (of course with updating the number of them), eventually change material/texture indexes for groups if they need to be different, and this way the mesh will be combined.

If meshes of stages aren't shifted, there is "Shipedit.exe" program in the "Orbitersdk/utils" subfolder of Orbiter, you can use to shift them (Transform -> Translate). And then merge them the way presented above.

You can also check [ame="http://www.orbithangar.com/searchid.php?ID=2740"]Mesh Wizard 1.9d[/ame]. You can use it for translating the mesh, but I'm not sure if there is an option to combine a few meshes into one.
 

jimd

New member
Joined
Mar 30, 2009
Messages
25
Reaction score
0
Points
0
Still slightly confused

I am not familiar enough yet with orbiters mesh files to understand fully what you said. If I understand correctly the individual meshes just need to be copied to a new file and listed out one following the other but I am confused about what needs to be changed in the new file so it will show all the individual elements.

Sorry for being a little dense here
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
I think you can get even more confused after my instructions how to merge meshes below.

Mesh files are text files you can edit with Notepad or other text editor. You can read more about them in "Orbitersdk/doc/3DModel.pdf" document.

An example mesh ({...} are snipped parts):
Code:
MSHX1
GROUPS 3
MATERIAL 1
TEXTURE 1
GEOM {...} {...}
{...}
MATERIAL 1
TEXTURE 2
GEOM {...} {...}
{...}
MATERIAL 2
TEXTURE 1
GEOM {...} {...}
{...}
MATERIALS 3
Mat_0
Mat_1
Mat_2
MATERIAL Mat_0
{...}
MATERIAL Mat_1
{...}
MATERIAL Mat_2
{...}
TEXTURES 2
{...}
Let's assume that 3 mesh files for stages are similar to this one.

You create an empty text file, copy the header and all the GEOM groups from the first stage mesh file, next you copy all the GEOM mesh groups from the second stage file ommitting the file header (the best is to note temporarily where it's starting, so you can easily update MATERIAL and TEXTURE entry for all groups from it), and the same for the third stage (all GEOM groups, i.e. definition of vertices and triangles). Don't forget you need to update "GROUPS" at the header to the number of total GEOM groups in the new file (i.e. add number from GROUPS of 1st, 2nd and 3rd stage mesh).

Next, you copy MATERIALS header and material names from first file, 2nd and 3rd (here is the best to note which materials are from which stage for updating them in mesh groups, and you might need to rename materials from the latter files, so their names aren't duplicated), then update number of materials, and then you copy MATERIAL definitions, from 1st, 2nd and 3rd file (of course if you renamed them earlier).

You can optimize materials if they are redundant, but you need to note it somehow temporarily, so you will have reference when you will update materials for mesh groups from merged stage 2 and 3.

Then you can update MATERIAL entries for mesh groups from merged stage 2 and 3 (i.e. 1st material on MATERIALS list has index 1, et al.).

Next, you copy TEXTURES header and list from 1st, list of textures from 2nd and 3rd file, and update number of TEXTURES.

The same as for MATERIALS, you optimize the list of TEXTURES and then TEXTURE entries for mesh groups of merged stage 2 and 3.

After that, you remove all notes you have made and any empty line you had between groups, materials, or textures, and your mesh file is ready, though it isn't optimized, because there can be invisible vertices and faces between stages, which you can remove with Mesh Wizard.

I haven't checked, but maybe somebody has created a program for merging Orbiter meshes, and you wouldn't need to do it all by hand, but if there isn't any, it would be easy to make one.
 

jimd

New member
Joined
Mar 30, 2009
Messages
25
Reaction score
0
Points
0
Got it working now

Thanks very much for this explanation. Between your information and some experimenting myself I got it to work. Now I just need to fiddle around with the amount of translation to get them to line up perfectly.

Thanks
 
Top