Open Astn opened 9 years ago
assimp sounds like some kind of hybrid donkey vs monkey - so it naturally has my approval :+1:
also this is based off assimp: https://github.com/acgessler/open3mod
Nice, and I've been making pretty good progress on converting .mdl -> obj
animated models as seen here: ftp://azbuildslave.cloudapp.net:2121/pod.wmv make me tingle
and here ftp://azbuildslave.cloudapp.net:2121/bom07.wmv
Check out the XFile parser - TRef
Was just browsing along and saw this todo. I had a need for *.obj Allegiance models, so I went and converted them. I don't know if you finished your conversion, or if the way I converted will be useful at all - but feel free to check them out. https://github.com/brianmxwll/AllegianceModels
I'm open to further modifications (or fork away obv) if they make them more broadly usable. Lemme know. I'm not a model expert so may have missed a detail somewhere along the line :)
That's sweet @brianmxwll I never did finish the mdl -> obj converter, and had never even thought of doing x->obj. I imagine what you have so far is enough to be able to test adding assimp to allegiance.
Here is the .net lib I created for loading .mdl files into memory so they could be converted. https://github.com/AllegianceZone/MDLReaderWriter
Awesome. Let me know if you run into any issues using the obj files. They may work for one purpose but not others, so definitely open to tweaking them to work for everyone.
The only thing I haven't focused on so far is creating a material (.obj.mtl) file for the derivative models like _static.obj. Those ones I just stripped all material reference from since I can't necessarily guarantee that the standard model and standard_static model are identical.
I'm seeing some mtl's in there. https://github.com/brianmxwll/AllegianceModels/blob/master/Models/cap300/obj/cap300.obj.mtl Is it enough to just add
mtllib cap300.obj.mtl
to the _static.obj file so they use the same .mtl as the non static .obj? Also what is the difference between the _static.obj and the other. No animation data?
Btw. looking in https://github.com/brianmxwll/AllegianceModels/blob/master/Models/cap300/cap300.x#L4673 I see animation set and anm-* and I'm not seeing that same data in the .obj file.
Maybe it would be better to convert to Collada ( .dae ).
edit The missing animation data might just be a problem with loading .x files in assimp. I don't see it when I run info, but its there when I look at the file directly.
.\assimp.exe info MSOriginal_GameArt\256\cap500.x
Launching asset import ... OK
Validating postprocessing flags ... OK
Importing file ... OK
import took approx. 0.00900 seconds
Memory consumption: 263975 B
Nodes: 83
Maximum depth 4
Meshes: 17
Animations: 1
Textures (embed.): 0
Materials: 7
Cameras: 0
Lights: 0
Vertices: 731
Faces: 610
Bones: 0
Animation Channels: 83
Primitive Types: triangles
Average faces/mesh 35
Average verts/mesh 43
Minimum point (-3.467470 -2.195105 -9.648870)
Maximum point (3.467469 2.866200 8.898458)
Center point (-0.000000 0.335548 -0.375206)
Named Materials:
'JoinedMaterial_#91'
'material1051'
'material2562'
'JoinedMaterial_#86'
'JoinedMaterial_#49'
'JoinedMaterial_#58'
'JoinedMaterial_#82'
Texture Refs:
'cap500.ppm'
'ss27inside.ppm'
Node hierarchy:
'frm-Body_1', meshes: 2
-- 'frm-tower_base', meshes: 1
-- -- 'frm-tower', meshes: 1
-- -- -- 'frm-antenna', meshes: 1
<--
<--
-- 'frm-L_engine_pod', meshes: 1
-- 'frm-r_engine_pod', meshes: 1
-- 'frm-cube1', meshes: 1
-- 'frm-cube3', meshes: 1
-- 'frm-launch1', meshes: 1
-- 'frm-garage1A', meshes: 1
-- 'frm-garage1B', meshes: 1
-- 'frm-garage1C', meshes: 1
-- 'frm-garage1D', meshes: 1
-- 'frm-garage1E', meshes: 1
-- 'frm-cockpit', meshes: 1
-- 'frm-thrust1', meshes: 1
-- 'frm-thrust2', meshes: 1
-- 'frm-SS01', meshes: 1
-- 'frm-SS2', meshes: 1
-- 'frm-SS3', meshes: 1
-- 'frm-SS4', meshes: 1
-- 'frm-SS5', meshes: 1
-- 'frm-SS6', meshes: 1
-- 'frm-SS7', meshes: 1
-- 'frm-SS8', meshes: 1
-- 'frm-SS9', meshes: 1
-- 'frm-SS10', meshes: 1
-- 'frm-SS11', meshes: 1
-- 'frm-SS19', meshes: 1
-- 'frm-SS20', meshes: 1
-- 'frm-SS21', meshes: 1
-- 'frm-SS12', meshes: 1
-- 'frm-SS13', meshes: 1
-- 'frm-SS18', meshes: 1
-- 'frm-SS17', meshes: 1
-- 'frm-SS16', meshes: 1
-- 'frm-SS15', meshes: 1
-- 'frm-SS14', meshes: 1
-- 'frm-SS22', meshes: 1
-- 'frm-SS23', meshes: 1
-- 'frm-SS24', meshes: 1
-- 'frm-SS25', meshes: 1
-- 'frm-SS26', meshes: 1
-- 'frm-SS27', meshes: 1
-- 'frm-SS28', meshes: 1
-- 'frm-SS29', meshes: 1
-- 'frm-SS30', meshes: 1
-- 'frm-SS31', meshes: 1
-- 'frm-SS32', meshes: 1
-- 'frm-SS33', meshes: 1
-- 'frm-SS35', meshes: 1
-- 'frm-SS37', meshes: 1
-- 'frm-SS34', meshes: 1
-- 'frm-SS36', meshes: 1
-- 'frm-SS38', meshes: 1
-- 'frm-SS39', meshes: 1
-- 'frm-SS40', meshes: 1
-- 'frm-SS41', meshes: 1
-- 'frm-SS42', meshes: 1
-- 'frm-SS43', meshes: 1
-- 'frm-SS44', meshes: 1
-- 'frm-SS45', meshes: 1
-- 'frm-SS46', meshes: 1
-- 'frm-SS47', meshes: 1
-- 'frm-SS48', meshes: 1
-- 'frm-SS49', meshes: 1
-- 'frm-SS50', meshes: 1
-- 'frm-SS51', meshes: 1
-- 'frm-SS52', meshes: 1
-- 'frm-SS53', meshes: 1
-- 'frm-SS54', meshes: 1
-- 'frm-SS55', meshes: 1
-- 'frm-SS56', meshes: 1
-- 'frm-SS57', meshes: 1
-- 'frm-SS58', meshes: 1
-- 'frm-SS59', meshes: 1
-- 'frm-SS60', meshes: 1
-- 'frm-SS61', meshes: 1
-- 'frm-trail', meshes: 1
-- 'frm-thrust3', meshes: 1
-- 'frm-thrust4', meshes: 1
-- 'frm-thrust6', meshes: 1
-- 'frm-thrust5', meshes: 1
<--
and from inside cap500.x
AnimationSet {
Animation anim-Body_1 {
{frm-Body_1}
AnimationKey {
2;
2;
1; 3; -0.000000, 0.014786, -0.014932;;,
100; 3; -0.000000, 0.014786, -0.014932;;;
}
}
Animation anim-tower_base {
{frm-tower_base}
AnimationKey {
2;
2;
1; 3; 0.000101, 1.452250, 0.128781;;,
100; 3; 0.000101, 1.452250, 0.128781;;;
}
}
...
I don't think just adding a reference to the .mtl will be sufficient - there are materials referenced in the .obj file for each mesh/submesh. See: https://github.com/brianmxwll/AllegianceModels/blob/master/Models/cap300/obj/cap300.obj#L1445
I'll look into the animation stuff when I have some time. I structured the repo to support different file formats, so a "dae" folder for each model would be just fine. Since obj files don't support animation, that's gonna be a hard stop if animation is required. Kind of a mixed bag, IMO, is there any animation in the models that's actually worthwhile? Besides bomber missile bays opening... kinda meh. Open to being wrong though haha
To tack on about the _static.obj files (ignoring animation for now), it wouldn't be too hard to add in the material references to match the standard .obj file. The obj file is broken up by meshes and Assimp outputs them into clean blocks - easy enough to parse through and add the appropriate material references.
The only unknown for me is the difference between .obj and _static.obj. Are -all- of those models (functionally, not literally) identical? If not, we would have to figure out which textures actually work and which ones dont... a manual process for sure.
Well we have never had the animation so we don't know what we are missing really. :P But games like Eve do a pretty good job making ships with animation. That doesn't mean we need to carry over the animations from the existing models if it is a pain. I was hoping it was the export format not supporting it that was the issue, but I think It has more to do with the .x files being imported.
Eh, it may or may not. Obj just doesn't support anims... so it might be worth checking out a diff format to see how it fares.
Open Asset Import Library is a Open Source library designed to load various 3d file formats and convert them into a shared, in-memory format. It supports more than 40 file formats for import and a growing selection of file formats for export.
This will let us start using standard model formats
https://github.com/assimp/assimp