Author Topic: a 3D model format (turrets and more)  (Read 3862 times)

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
a 3D model format (turrets and more)
« on: 27 January 2011, 10:39:12 »
The current G3D format is a morph-target (http://en.wikipedia.org/wiki/Morph_target_animation) animation format.

To be honest, whilst skeletal animation is 'better' and it might lead to slightly less artefacts in things like rolling wheels, there isn't a pressing need to migrate the existing models to anything else.

But if you want to do things like turrets, it seems the straightforward approach is to adopt skeletal animation (http://gamedev.stackexchange.com/questions/7754/how-to-export-3d-models-that-consist-of-several-parts-eg-turret-on-a-tank/7760#7760)

I would propose that the MD5 format is adopted.  It seems ubiquitous and easy to export and easy to load.

For turrets, the information about what meshes align with could be encoded in the mesh names.  However, the information about their maximum traversal etc would not fit so easily there, so I'd therefore suggest the information about which mesh points at the target etc should be encoded in the model's xml file instead, e.g.

Code: [Select]
<animation path="models/dragon.md5anim">
   <align mesh="turret" at="target0" miny="0" maxy="0" /> <!-- not constrained in the xz so it can spin -->
   <align mesh="barrel" at="target0" miny="-15" maxy="+25" minx="0" maxx="0" minz="0" maxz="0" /> <!-- only limited movement on y supported -->
   <align mesh="flag" at="wind" /> <!-- follow the wind, perhaps the engine factors in speed and direction of unit too -->
</animation>

There could be multiple targets supported by using
Code: [Select]
at="targetN" notation etc how might that best fit Glest?  If only one target can be engaged by one unit at a time, then the 'at' should still be labelled 0 so as to make it obvious we might extend it in the future?

And the 'at' might not just be targets, but also 'upwards' - so rider bodies point upwards when going up and down slopes - and 'wind' as shown in the example, e.g. for sails on ships and flags and washing-lines and such.
« Last Edit: 27 January 2011, 10:43:20 by will »

Mr War

  • Guest
Re: a 3D model format (turrets and more)
« Reply #1 on: 27 January 2011, 21:18:35 »
sounds really interesting, would you be able to have multiple turrets?


Zoythrus

  • Guest
Re: a 3D model format (turrets and more)
« Reply #2 on: 27 January 2011, 23:23:08 »
nobody is sure what would happen if there were multiple turrets, especially if the attacking unit was moving. but since i proved that a mobile garrison was absolutely okay with firing on the move (it had units in it). multiple turrets should also be similar, there shouldnt be any probs....

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: a 3D model format (turrets and more)
« Reply #3 on: 28 January 2011, 04:54:45 »
Full support.

I've used the MD5 format before, and it's probably one of the stablest, easiest to use model formats I've used. All the major engines can use it, and a lot of other games use it too. For example, off the top of my head, it's the ideal format for the Irrlicht engine, and games like UFO:AI (MD2) and Nexuiz (MD3) use older variations of the same similar model format. Thus, I think it fits Glest well, and it will allow more people to jump into modding, as well as qualm troubles with exporting (and allow turrets, as Will mentioned). MD5 is from Doom 3, which dates back to 2005, but as far as file formats go, there's never been a need to change it, as it does everything very well.

Most modelling programs support MD5 (and its predecessors), and it's well defined, easy to use, and commonly place.


There's probably tons of "examples" for how to export MD5 though by looking at the source of programs and engines that support it. Fun fact: Military's heli model is imported from a MD2 from UFO:AI.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
Re: a 3D model format (turrets and more)
« Reply #4 on: 1 February 2011, 06:40:09 »
I don't think G3D v4 will go away though.  If we can just get bump-maps into all the engines, its got a very useful life yet!  There is a natural progression in modelling formats and the older formats are more simple and therefore faster to render.  So you want to pick the simplest format that supports what you want to achieve for each model.

Most model formats can be pegged to a Doom timeline:

MDL (Quake) and MD2 (Quake2) are equivalent to G3D.  The model is one or more meshes, where each mesh has each vertex position per frame and is interpolated to render between frames.  I can spot no advantage with MD2 and over G3D v4.  Drawing these models is quick and easy - at long range / small on-screen size you can simply calculate the nearest frame and send that to the card without interpolation; closer up you can do your interpolation in a shader.

The problem with these formats is they don't give you forward/inverse kinetics http://en.wikipedia.org/wiki/Inverse_kinematics.

The solution to kinetics is to have a 'bone' model format.  This came with MD5 (Doom3).  The model is made from bones / joints and vertices, where each vertex is attached - by various weights - to some of bones.  In this way you can have good-looking arms that move without looking like an action man.

So bone formats like MD5 are the high-tech modelling today.  They allow very nice movement of humanoids even when those humanoids are drawn very large on the screen.  But with an RTS, most units are drawn small and many don't have joint problems.

Rendering a bone format like MD5 is a struggle for shaders and other high-performance paths since the number of weights is per vertex and potentially large.  Many engines limit the number of bones that can influence a vertex and end up nop-padding the array of matrices per vertex.  All not very satisfactory.  So bones in shaders are challenging and going to be slower than a simple interpolation solution.  (I would love to be wrong about this.)

MD5 does have additional scene-management animation format which could be very useful for choreographing the interaction of units and buildings especially during build time.

MD3 is a rare format that is half way between MD2 and MD5.  Its interesting in that there is export from blender support and I am still trying to understand if it offers the speed of MD2 with the extra turret support that a fuller bone system would give.  But its not widely used.
 
Collada is a bone format (adopted by Unreal Tournament for example) that is an open standard but is notoriously powerful i.e. complex to implement.  It is used by the 0ad game.

I think that MD5 would be an excellent complement to G3D, but that we might have to limit the number of weights supported (pruning on load) and a clever renderer will attempt to redivide the mesh into parts that have n weights and so on.  How MD5 might support team colours is still open.

Creating an MD5-equiv bone format for G3D v5 would be perfectly possible and not so scary actually.

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: a 3D model format (turrets and more)
« Reply #5 on: 1 February 2011, 16:44:31 »
I've used the MD5 format before, and it's probably one of the stablest, easiest to use model formats I've used.
There's probably tons of "examples" for how to export MD5 though by looking at the source of programs and engines that support it.
I searched everywhere I could and still can not find out how export to MD5... :(
Get the Vbros': Packs 1, 2, 3, 4, and 5!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: a 3D model format (turrets and more)
« Reply #6 on: 1 February 2011, 20:29:21 »
MD5 Export:
This link is very helpful, as well, the exporters themselves are here (available for both 2.49 and 2.5.x).
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: a 3D model format (turrets and more)
« Reply #7 on: 2 February 2011, 17:14:28 »
MD5 Export:
This link is very helpful, as well, the exporters themselves are here (available for both 2.49 and 2.5.x).

Thanks, but I have the exporter but when I export it comes out untextured, and animated wrong, sideways, ect.

And I did google it still nothing.

Get the Vbros': Packs 1, 2, 3, 4, and 5!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: a 3D model format (turrets and more)
« Reply #8 on: 3 February 2011, 01:08:13 »
Actually, it's Glest models that are sideways. The exporter uses right way up, like most of Blender's exporters do. You'll also have to read the instructions on how to export. ;)
« Last Edit: 4 February 2011, 03:39:53 by Omega »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: a 3D model format (turrets and more)
« Reply #9 on: 3 February 2011, 06:48:40 »
Actually, it's Glest models that are sidewise. The exporter uses right way up, like most of Blender's exporters do. You'll also have to read the instructions on how to export. ;)
Where are the instructions? And I started my modelling with glest so the way glest models are was upright to me.
Get the Vbros': Packs 1, 2, 3, 4, and 5!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: a 3D model format (turrets and more)
« Reply #10 on: 4 February 2011, 03:42:13 »
The link for the usage instructions is on the page bro. Might wanna read it first  ;)

http://www.katsbits.com/smforum/index.php?topic=178.0
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert