Author Topic: particles bound to models  (Read 1286 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
particles bound to models
« on: 28 May 2013, 21:28:31 »
Something that would give a really big benefit are model bound particle systems. Those should be easy to add teh following way:

Imagine you have a human model and you want a particle system that follows the hand of the model, you should be able to do the following:

- Add a minimodel as its own object to the hand and animate it with the hand.
- Give this object in the model a name ( for example: "particle_anchor_hand" )
- Reference this object by name in your particle system.
- Place/move the particle system according to the first vertice/point of the named model.

Something thats realy needed for this is a possibility to show the object names of models in the g3d-viewer. ( I tried it and this part is not so easy )

Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: particles bound to models
« Reply #1 on: 3 January 2014, 18:55:53 »
Would something like this destroy the compatibility of 3.9.0 and a future 3.9.1 ?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: particles bound to models
« Reply #2 on: 3 January 2014, 23:13:38 »
Yes i think so as it would likely change the file format.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: particles bound to models
« Reply #3 on: 4 January 2014, 00:19:57 »
Instead of changing the model format, could we not provide a separate model that is which the particles are bound to? And then in the XML file, we can add any number of "particle models" to each skill. The particle models are not actually displayed, but merely serve as an "outline" for binding particles.

To use an example, we could have the regular battlemage model as it is, but also add a model that is just the battlemage's hands as they move during his attack animation. We'd add a link to this model in the attack skill, allowing us to bind particles to this model. Syntax could be something like:

Code: [Select]
<skill>
<!-- ... -->

<animation path="models/archmage_attacking.g3d"/>
<particle-bounds>
<model path="models/hands.g3d" particles="particles_hand.xml" />
</particle-bounds>

<!-- ... -->
</skill>

In addition to not requiring changes to the G3D format, this approach would allow us to be modular in creating particle bounds. We could have a base model and then models for different bounds which could be used for different skills (eg, we might have particles bound to the hands of a unit for their attack animation only, with different particles for a different animation, and no particles bound for other animations).

However, the G3D viewer should also be updated to be able to load these particle bounds in. This is a little more tricky given that we'd have to load in both a model AND a particle XML.

Side note: perhaps it should be possible to point the G3D viewer at a unit XML and it would be able to load all the animations as they would appear for each skill? This would provide an easy way of loading models with many particles in, and allow previewing units rather than individual models?
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: particles bound to models
« Reply #4 on: 4 January 2014, 02:10:20 »
I already implemented it now and no changes to the model format were needed!

We always had a model made of several Meshes and each Mesh had a name! It works very good so far:
(click to show/hide)

A small problem that I still have are "fixed" particle systems and this mesh bounding. But as the update of the units mesh is limited to the normal unit update ticks (30/s )  I think it would look bad anyway .
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: particles bound to models
« Reply #5 on: 4 January 2014, 18:00:31 »
This is in svn now, please test and tell me what you think. The mesh position is only updated 30 times per second so fast moving meshes will not show particles 100% in place.
Here is an example g3d and particle.xml you can use to play with it:  http://titi.megaglest.org/tmp/meshBound.zip

Infos:
- As offset you must set "z" and "x" to 0 and you need to remove the heights of the unit ( half of the size ). So if units size is set to 6 ( like in my example ) you must give an offset of -3 to compensate it.  ( 6/2 = 3 )
- The Mesh Name:  somehow the current exporter adds .001 to the names while exporting ...  In my examples case original name was  "part1" (for particle1) . In the g3d/game the particle is called "part1.001" . I don't know why yet.  To see the real names of the meshes you exported use G3dHack at the moment. (https://forum.megaglest.org/index.php?topic=7083.0)
- in my example you see a mesh which is only a triangle. In blender this was an extra model which I gave a name ( name was part1 )
« Last Edit: 4 January 2014, 18:08:21 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

atze

  • Technician
  • ****
  • Posts: 119
    • View Profile
Re: particles bound to models
« Reply #6 on: 5 January 2014, 22:02:16 »
After an initial misunderstanding :confused:, I did it but then managed ;D (thx titi). I find this feature quite cool :thumbup: :).

 Here is an example of the poison attack of spearmen:
(click to show/hide)
this signature is not available in your country

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: particles bound to models
« Reply #7 on: 6 January 2014, 00:22:30 »
I added a warning if the given meshName is wrong. It writes some useful infos to stdout like all meshNames and so on .
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: particles bound to models
« Reply #8 on: 19 January 2014, 13:31:46 »
Sounds very promising!

Can this be done with projectiles?

Are particles be oriented with the mesh they are attached to, or the unit's orientation?
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: particles bound to models
« Reply #9 on: 19 January 2014, 18:22:24 »
Nice UI Atze, Looks Very cool. :).
WiP Game developer.
I do danish translations.
"i break stuff"

atze

  • Technician
  • ****
  • Posts: 119
    • View Profile
Re: particles bound to models
« Reply #10 on: 23 January 2014, 12:40:46 »
Nice UI Atze, Looks Very cool. :).

Thank you, nice that you like it. :) Is the HUD from "Prax". I think you can also use it for other techtrees (megapack, japanese etc.), if you like. I guess not that it comes at a techtree error message while multiplayer. However, I am not 100% sure. :|
this signature is not available in your country

 

anything