Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

New model utilities

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 2020
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Re: New model utilities

Post by maik »

Hehe :D

I took a quick look at Wings3D and Blender plugin programming. Wings3D seems to require Erlang programming which I don't find terribly useful to learn. Blender on the other hand can be extended using Python. I'll add this to my want-to-explore-when-I-find-the-time list, but don't hold your breath!
Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: New model utilities

Post by Fritz »

I'll just warm up this old thread...

Importing an Oolite model to SketchUp was just what I was looking for, because I'm used to SketchUp and I don't want to learn another 3D program. I even thought about writing a converter myself, as the dat file format doesn't seem to be very complex.

I imported (of course) Griff's "Python trader" model, and it seems to work (I'm using version 7). I'm just wondering about some things:

1) The z-axis (the vertical axis in SketchUp and virtually everywhere else) seems to be the longitudinal axis in Oolite (I remember this from earlier experiments). This is a little bit awkward in SketchUp, but of course it is possible to rotate the model.

2) What is the scale unit used in Oolite dat files? I always thought it was the metre, but in SketchUp the Python is only about 3.40 m long instead of 133.888 m as given in the "model size" comment line in the dat file. There doesn't seem to be any round factor involved, or something like feet or inches.

3) Each flat surface of the model is divided by lines to form triangles. Is there a reason for this? Does Oolite only work with models made out of triangles?

No more time this night, I'll continue my experiments tomorrow.
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: New model utilities

Post by Fritz »

Mystery 2) is solved. The unit used in the dat files is metres, but SketchUp interprets the numbers as inches. So the 133.888 m length of the Python is reduced to 133.888", that's exactly 3400.7552 mm. Rounding seems to be leading to some inaccuracies in the model, so scaling it up inside SketchUp isn't ideal.

But the converting script could simply convert the metre values to inches. I'll try this tomorrow.
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 666
Joined: Sat Aug 09, 2014 4:16 pm

Re: New model utilities

Post by Commander_X »

If I may anticipate the replies of the developers:
1) the Z axis is the longitudinal due to OpenGL (and I think DirectX too) "tradition": there is no camera in these APIs, the view is always centered in the origin, and oriented (in OpenGL at least) along the -Z direction.
3) the graphics cards process triangles; although quads could be an option, triangulated surfaces are the best bet, performance wise -- the quads are just easier to be triangulated, but sending _only_ triangles to the GPU makes things faster (by avoiding the extra triangulation process). Most of 3D modeling software have the option to triangulate the model once it's finished (and during modelling you are always directed to use quads in order to make this final step -- that is, the triangulation -- smoother).
Fritz
---- E L I T E ----
---- E L I T E ----
Posts: 591
Joined: Sun Jul 12, 2015 2:30 pm
Location: Bavaria, Germany
Contact:

Re: New model utilities

Post by Fritz »

Thanks for the triangle explanation! I've seen that the dat files can only handle triangles anyhow, so this would be something to consider, when exporting a SketchUp model back to dat.

Scale transformation from metres to inches is working. Just add

Code: Select all

scale = 39.37007874
and change the line

Code: Select all

@verts.push(Array[vertex_line[0].to_f, vertex_line[1].to_f, vertex_line[2].to_f])
to

Code: Select all

@verts.push(Array[vertex_line[0].to_f * scale, vertex_line[1].to_f * scale, vertex_line[2].to_f * scale])
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
Post Reply