Helpful Hints From Gernot
Hi archamedes
Gernot got back to me via PM on the SSC. Here is his advice he sent to me, also he promises to open a thread soon on the SSC where he go into even more depth on creating models. Anyways without further ado, here is Gernot, hope that helps you
"The meshes have to be exported from 3dsMAX as wavefront objects (.obj) that's the easy part so far.
there are some things he would have to know about the LUA models even when he doesn't sets up the script himself.
you can have (and it's recommended) different detailed models for a maximum of 4 Levels of Detail.
to solve this there are many ways, either build a model for each lod, or to restrict details on lower lod's.
imo, to have a separated untextured collision mesh, a low-res and a high-res model is already good.
one must be always there, this is a so called collision mesh, however yoou will use the lowest lod it represents the collision mesh of the ship in the game (to make possible to get hit, shot, land, or scoop a good. theoretically could be used one mesh for all, but it really harms the performance of the game if you use 10'000 polys for a collision mesh and it's really not needed, in most cases you could say a box would be enough, anyway something that roughly represents the shape of the ship.
so we need at least one textured mesh and one simple untextured (but needs UV data, else it can't get loaded, simply "reset" UV for a collision mesh).
you can use different shaded materials in the script, i recommend this, of course you could use one material for all. but imo it's quite a difference if i have i.e. simply "Gold" as a texture or if i set the material "Gold" and give it a special specularity.
using different materials means each material needs a own object.
wavefronts "matlib" isn't supported no more in no way.
pioneers supports only a glow_map as additional texture mapping so far, but you can set even the material glowing, each has it's drawback and advantage.
some more characteristics of pioneer and the wavefront format;
- make sure to export models with Y as "up" vector.
- it needs at least one low poly mesh as collision mesh, to scoop goods the ships need a special collision mesh for.
Spoiler: hide
this to get a flagged geometry where the goods can collide with, i recommend therefore a simple quad 5m x 5m or more, 10m in front of the position of the scoop, i made already some experiments and i have to say even with 10m distance to the real position it's still very difficult to scoop something. in FE2 i remember the distance as ~0.02 km which would have been 20m in front of the scoops position
- all wavefront meshes need texture UV coordinates, if they are textured or not.
- models in pioneer are righthanded, while max's, like most other CAD, coordinate system is lefthanded.
that means you have either to build the model with the nose pointing backwards, or to invert the x and z axis in the script to let it face in the right direction. i would recommend to build it facing in the wrong direction. usually the two different coordinate sytems would lead to mirrored UV coordinates, but our devs "fixed" that so you can use the texture as you used in the CAD.
but exactly this will lead now to the problem that they are inverted if you would build the model proper (nose front) and change the coordinate system in the script, which would be the proper or basically correct way (with one disadvantage, left becomes right then, while there is a possibility even to avoid this, and that's why i builded my models nose facing backwards, it's annoying to load every part with "matrix.new(v(-1,0,0),v(0,1,0),v(0,0,-1))" or "matrix.new(v(1,0,0),v(0,1,0),v(0,0,-1))" and a following "set_insideout = true", and it seems everybody has followed me in doing so, which further has lead to the change of the UV coordinates).
- work with one sided material in your CAD to be sure to get (visually) the right normals for Pioneer (back faces must be black or culled).
- pioneer can't handle texture islands on smoothened surfaces (unified vertices).
not yet, i hope that will change once, i know it's possible, even with wavefront. at least i have no problems displaying such parts correct in a common modelviewer. to explain that a little more, no texture islands means; a part with unified verts. must have a texture projection where the same vertices are unified in, you cant i.e. project a sphere proper from two sides, except you split the vertices, which leads then to a hard edge. if you do it nonetheless the texture will get smeared between the texture islands. so even you can't break some faces out of a projection and place them on a different texture or to a different position on the texture, without splitting the coresponding vertices.
- wavefront supports no animations, they must be made in the script. difficult i know, in general there are two ways.
the "poor mans" solution, create a animation as usual in your CAD, export each position/frame as a single model and load them afterwards one by one in the script. i don't like this, it's not really animated, it's displaying a part after the other and not fluid.
the real thing (argh), means you have to export the objects for animated parts with their axis centered to "world" or "scene" (in most cases) and to position, translate and rotate them later on with expressions. TAHAT'S complicated i know, but it helps when you start to think how it has to work in the CAD, or build the animation in the CAD and watch how it works, that helps and you will need to do it at least roughly to get the values for a translation (coordinates) or rotation (degrees).
i hope that covers his request, if he likes to set up the script himself, he might need further help.
the LUA models system is explained here,
http://eatenbyagrue.org/f/pioneer/codedoc/files/LmrModel-cpp.html
i use it myself very often.
i know i have to open a thread where all the specialities of the LMR get explained somewhat. especially to make it accessable for people who just like to get quickly a own model running in pioneer, this is possible it won't need much and i guess in 2 or 3 hours almost anyone can make a script for a model like the "Eye" or any else which is not animated or simple animated."