Project Blender 2.63 + to Orbiter import/export addon

It might be what rendering engine you have set. Make sure you have Blender Render set for the blender rendering engine (top middle of screen, drop down menu), and the viewport shading set to Texture.

If you want to render using cycles, be sure to set Device to GPU Compute in the render panel (if you have a CUDA enabled NVidia card), and you'll have to re-assign the textures manually. Click an object, click the materials button in the properties window, and click "use nodes", then you can click the button to the right of the color picker, select "image texture", then use the "open" button that appears to manually select the DDS file from the textures folder.

Hope that helps.
 
I think there is a problem with the groups numbers assignements :
Trying an import of the Shuttle PB Mk2 (for my project) and then export to MSH file.
First the I see groups have changed because not the well parts are moving, and in 2nd, the textures are not rendered.
I hope it helps the developpement, (and I want to know if the problem occur only for me and not for others ...)
 
1. after importing in Blender: in Blender set Blender Render (see post Spacenut), and set Viewport shading to Texture in taskbar 3d view, next to object
2. On export textures are copied to PBshuttletex directory in directory Meshes. Either copy this directory to Textures directory, or modify .msh file with notepad at end of file under Textures: PBShuttle2tex\PBMK2NOSE.dds to PBMK2NOSE.dds for all the textures.
3. Groups on import and export are sorted alphabetically on name in Label header. If there is no name then in my addon (see [FONT=&quot]http://orbiter-forum.com/showthread.php?t=18661&page=9http://orbiter-forum.com/showthread.php?t=18661&page=9[/FONT] , astrogull). [FONT=&quot]http://orbiter-forum.com/showthread.php?t=18661&page=9I[/FONT][FONT=&quot]t gets the name in GEOM header after semicolon. Beware, no spaces, etc. only letters and numbers.
Zero fill spaces and/or remove spaces otherwise 'material03 8' comes after 'material03 16', so a solution is material0308 and material0316

Rename material 4 26 to f.i. to material1426, the last group.

[/FONT][FONT=&quot]In Blender groupnames: uppercase come before lowercase. If you wat to number names, make them of equal length, f.i. myname001, myname099, myname100[/FONT]

See repaired mesh




[FONT=&quot]
http://orbiter-forum.com/showthread.php?t=18661&page=9[/FONT]
 

Attachments

As far as importing and re-exporting a mesh is concerned, the script orders the groups in alphabetical order. I have created a workaround for this that sticks the group number at the beginning of the object names to preserve group order on export (as names are only used to pre-generate a header file, DLLs work off group number not name). I sent this modification to Vlad for his consideration and it or a similar option may be included in future versions.

For right now, unless you make similar modifications yourself, the script is not useful for editing existing meshes for use with their original crafts. Animations will break.
 
Sounds like a good idea. So simple. One comment. Beware that 1myname is sorted after 10myname, 100myname, you still have to zerofill the numbers, like 001myname etc., in case you didn't know allready. 3 digits seems enough as there are seldom 999 groups or more.
 
As far as importing and re-exporting a mesh is concerned, the script orders the groups in alphabetical order. I have created a workaround for this that sticks the group number at the beginning of the object names to preserve group order on export (as names are only used to pre-generate a header file, DLLs work off group number not name). I sent this modification to Vlad for his consideration and it or a similar option may be included in future versions.

Oh, I've already made it but forgot to push it to Gitorious and Github. Now you can check the code, it's different from yours (without additional create_mesh parameter and multiple "if" statements)

SolarLiner, Rybec, Astrogull and others, you can download a new version and enable "Add index to mesh name" checkbox in Import dialog.

Now I'm looking at Astrogull's fixes and applying them into an another branch, but unfortunately I haven't enough time:)
 
Last edited:
On second thought: I want to preserve labelnames if possible, as meaningfull names makes working with many groups/objects in blender a lot easier.
So here is my solution:
Check if labelnames preserve grouporder on import, if not prefix all the labelnames with groupnumber, else accept the labelnames as they are.
Now after one import-export run the labels won't be altered.
No option needed, meshes with correct labels need no correction.

see updated script
 

Attachments

Last edited:
Why not go one further an add an option to remove the prefix numbers on export. That way you can preserve group order AND name. I just made that modification to my own copy, I haven't looked at the latest official yet.
 
I hate options, but as I discovered allmost al the orbiter meshes need labelprefixes I implemented your suggestion. So for people who want to use these exports in other modelling software there is now an option to remove the label prefix if they are numbers.
Luckily it is only a problem with imported meshes
see update at
script update

---------- Post added 07-27-12 at 02:55 PM ---------- Previous post was 07-26-12 at 05:29 PM ----------
I hate to admit it (what do I not hate, this script?) but I found another bug. Playing with some old .msh files with transparent textures, I discovered Orbiter uses for materials specular hardness=0, while minimum sh in blender is 1.
So after export the textures weren't visible in Orbiter, thanks to sh=1.
Changing them back to 0 in the material, or set spec.color to 0,0,0 resolved this issue.

I found a workaround: on import if sh=0, set mat.specular_alpha=0, and on export if specular_alpha==0 then set orbiter spec.hardness=0 for this material.
But maybe someone knows a better way to store sh=0 in Blender?

---------- Post added 07-30-12 at 05:08 PM ---------- Previous post was 07-27-12 at 02:55 PM ----------

In addition I forgot to mention that when specular power is missing in Orbiter, it is default 0 which Blender changes to default specular hardness=50.
In stead of using spec.alpha now I think it's better to set sh to 1 when spec.power is missing or 0 on import and set sh=1 to sp=0 on export.
See script update at
script update
 
Last edited:
1. after importing in Blender: in Blender set Blender Render (see post Spacenut), and set Viewport shading to Texture in taskbar 3d view, next to object
2. On export textures are copied to PBshuttletex directory in directory Meshes. Either copy this directory to Textures directory, or modify .msh file with notepad at end of file under Textures: PBShuttle2tex\PBMK2NOSE.dds to PBMK2NOSE.dds for all the textures.
3. Groups on import and export are sorted alphabetically on name in Label header. If there is no name then in my addon (see [FONT=&quot]http://orbiter-forum.com/showthread.php?t=18661&page=9http://orbiter-forum.com/showthread.php?t=18661&page=9[/FONT] , astrogull). [FONT=&quot]http://orbiter-forum.com/showthread.php?t=18661&page=9I[/FONT][FONT=&quot]t gets the name in GEOM header after semicolon. Beware, no spaces, etc. only letters and numbers.
Zero fill spaces and/or remove spaces otherwise 'material03 8' comes after 'material03 16', so a solution is material0308 and material0316

Rename material 4 26 to f.i. to material1426, the last group.

[/FONT][FONT=&quot]In Blender groupnames: uppercase come before lowercase. If you wat to number names, make them of equal length, f.i. myname001, myname099, myname100[/FONT]


After a test with Suzanne, I saw that "TEXTURES" is 0, at the bottom of the mesh file. However, I've been UV Unwrapped Suzanne. Else, the "Save As DDS" script doesn't work for me. (In UV/Texture -> Image)
EDIT: Maybe I know why ... Just test ...
EDIT2: Okay, It is my fault, forgot to define the texture in the right panel


It is OK for alphabetically sorted groups. I'll rename them.

Something noticed too: the mesh is always smoothed when exporting.

I return test the PB2 Mesh ...
 
Last edited:
I too noticed that everything is marked smooth on export. An easy work around is to use the Edge Split modifier which physically disconnects edges for sharpness. In my experience, this often gives better shading results than setting faces to be shaded flat even for in-blender projects. It is also easy to use, if the split by angle option doesn't do what you like you can simply mark edges to be sharpened via the Ctrl-E menu in edit mode "Mark Sharp".

It would be nice to set an entire mesh group to be flat without having to add a modifier or physically split every object, though. The old blender export script supported this, because I remember splitting things into separate mesh groups to build hard edges.
 
It is the transition from smooth to sharp edges in a group, which give the ugly results when marking everything smooth on export. After import all the groups are flat shaded. What I used to do to cleanup the mesh import on making a .blend file:
1. Select all groups and set smooth in Object Mode. This way you can inspect the groups which are set flat shaded. In some cases you have to inspect the model in Orbiter.
2. Remove double vertices for all groups just to be safe. Now ugly smooth effects appear on sharp edges.
3. Set flat groups from point 1 to flat shaded in Object Mode.
4. (Border)Select the vertices in the sharp edges in smoothed groups and split vertices with ctrl V, Split, (no extra mesh groups), and save the blender file.
This procedure gives for me the best result.

Im my script in post
script update
there is an option Smooth all, default True to stay in line with Vlad's script, but my choice would be to uncheck it by default (which I do), or remove it all together (everything flat), for then it would serve for me as a reminder to smooth only selected faces/groups, or smooth all groups except flat one's. Then cleanup the ugly looking one's.

I think, when you follow this line of working (uncheck smooth all) there is no need for an operator to flatten a smoothed group with sharp edges, if that is what you mean.

Are you talking about vlad's script or mine? I hope he can find the time to incorporate my suggestions in his, for then whe can talk about the same script, which is better then start a separate branch.

Something noticed too: the mesh is always smoothed when exporting.
You can uncheck Smooth all, see the mentioned post above above.
 
I tried the new script but get this errors. blender 2.64 trying to export from a blend to msh.
blendermesh_zps7c09a33b.jpg
 
I tried the new script but get this errors. blender 2.64 trying to export from a blend to msh.
blendermesh_zps7c09a33b.jpg

Try to add a material to your mesh; use old Blender renderer, not Cycles.
Or you can try my original addon. It is without Astrogull's stuff yet.
 
Last edited:
It is the transition from smooth to sharp edges in a group, which give the ugly results when marking everything smooth on export. After import all the groups are flat shaded. What I used to do to cleanup the mesh import on making a .blend file:
1. Select all groups and set smooth in Object Mode. This way you can inspect the groups which are set flat shaded. In some cases you have to inspect the model in Orbiter.
2. Remove double vertices for all groups just to be safe. Now ugly smooth effects appear on sharp edges.
3. Set flat groups from point 1 to flat shaded in Object Mode.
4. (Border)Select the vertices in the sharp edges in smoothed groups and split vertices with ctrl V, Split, (no extra mesh groups), and save the blender file.
This procedure gives for me the best result.

Im my script in post there is an option Smooth all, default True to stay in line with Vlad's script, but my choice would be to uncheck it by default (which I do), or remove it all together (everything flat), for then it would serve for me as a reminder to smooth only selected faces/groups, or smooth all groups except flat one's. Then cleanup the ugly looking one's.

I think, when you follow this line of working (uncheck smooth all) there is no need for an operator to flatten a smoothed group with sharp edges, if that is what you mean.

Are you talking about vlad's script or mine? I hope he can find the time to incorporate my suggestions in his, for then whe can talk about the same script, which is better then start a separate branch.


You can uncheck Smooth all, see the mentioned post above above.

The same effect can be achieved much more simply from within blender using the "Edge Split" modifier.

I do my own mesh/certx optimisation so I'd rather the script not touch them at all.
 
This is certainly some problem with the mesh, nevertheless I get this error with the Blender exporter:

exporterror.jpg


Any advice?

I can export the mesh fine to 3DS then import in Anim8 then export to msh. But Orbiter crashes sometimes on reading it, other times shows the mesh untextured. I'm kind of lost.
So I know it a mesh problem.

What should I look for in Blender? I've applied all the modifiers, all textures look OK in the 3D preview and rendered.
 
Did you make all faces single sided ?
 
4thRock, just in case you forgot, before exporting to 3DS with An8, make sure you select ALL, then select Ungroup, then select Convert to Mesh, then Export to Orbiter mesh.
 
This is certainly some problem with the mesh, nevertheless I get this error with the Blender exporter:

exporterror.jpg


Any advice?

Try exporting individual objects from your mesh so until you isolate the specific object causing the error.

Once you've found the culprit check the UV and normal maps to make sure they're valid and eliminate any orphaned edges/vertices.
 
Thanks for the input, it was helpful.

After many hours trying to fix things like non manifold meshes and the such I'm still stuck.
The msh exporter still gives errors.

Exporting to 3DS does work, but I get no textures in anim8 (it tries to read .jp or . files) and it messes face orientation.

I tested in Sketchup I get textures and mapping fine, but the severall mesh objects are misplaced and out of scale. I know that this has to do with apply rotations, scale, etc, etc.

I do have experience with 3d meshes but I'm stumped... :hmm:
Will keep at it!
 
Back
Top