Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 01:03

All times are UTC + 1 hour




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Vertex Animation
PostPosted: 30.01.2017, 11:42 
Offline

Joined: 02.04.2013, 16:49
Posts: 36
Hi,

I was wondering how I can do Vertex or Morph animation with Horde3D. I would like to know what exporter do I use to properly convert a DAE file with vertex animation or if the current Blender exporter supports this and how?

Last thing is I would assume you use the Geometry flag instead when doing animation updates as referenced here..
https://github.com/horde3d/Horde3D/blob ... odel.h#L52

I have a Quake MD2 file to test it with to convert to Horde 3D format.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 12:46 
Offline

Joined: 17.11.2009, 17:00
Posts: 205
Location: Russia, Moscow
Horde was developed with OpenCollada in mind, but latest version of Autodesk Collada exporter are working as well. As for Blender - well, it depends. It may work, but as well may not work with default collada exporter (I don't know about Blender to Horde exporter).

And yes, you should call h3dSetupModelAnimStage() to set animation for your node;
h3dUpdateModel( node, H3DModelUpdateFlags::Geometry ) and, probably, h3dSetModelMorpher during update.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 14:48 
Offline

Joined: 02.04.2013, 16:49
Posts: 36
Thanks Idris! :) I'm a bit confused on how it is setup. Does it produce a separate anim file like bone animations? What's the recommended settings (tickboxes, etc) for the open collada exporter in max? If the latest is supported, I guess it's Collada 1.4.1 right?

As for the Blender Exporter, I'm presented with this scene file with some hints and the geo file is larger than the bone animation counterpart with no .anim file. (19mb, 198 frames, ~1.5k polys)

Code:
<Model name="soldier2" geometry="models\soldier2\soldier2.geo">
   <!-- Morph targets: "Key.001" "Key.002" "Key.003" "Key.004" "Key.005" "Key.006" "Key.007" "Key.008" "Key.009" "Key.010" "Key.011" "Key.012" "Key.013" "Key.014" "Key.015" "Key.016" "Key.017" "Key.018" "Key.019" "Key.020" "Key.021" "Key.022" "Key.023" "Key.024" "Key.025" "Key.026" "Key.027" "Key.028" "Key.029" "Key.030" "Key.031" "Key.032" "Key.033" "Key.034" "Key.035" "Key.036" "Key.037" "Key.038" "Key.039" "Key.040" "Key.041" "Key.042" "Key.043" "Key.044" "Key.045" "Key.046" "Key.047" "Key.048" "Key.049" "Key.050" "Key.051" "Key.052" "Key.053" "Key.054" "Key.055" "Key.056" "Key.057" "Key.058" "Key.059" "Key.060" "Key.061" "Key.062" "Key.063" "Key.064" "Key.065" "Key.066" "Key.067" "Key.068" "Key.069" "Key.070" "Key.071" "Key.072" "Key.073" "Key.074" "Key.075" "Key.076" "Key.077" "Key.078" "Key.079" "Key.080" "Key.081" "Key.082" "Key.083" "Key.084" "Key.085" "Key.086" "Key.087" "Key.088" "Key.089" "Key.090" "Key.091" "Key.092" "Key.093" "Key.094" "Key.095" "Key.096" "Key.097" "Key.098" "Key.099" "Key.100" "Key.101" "Key.102" "Key.103" "Key.104" "Key.105" "Key.106" "Key.107" "Key.108" "Key.109" "Key.110" "Key.111" "Key.112" "Key.113" "Key.114" "Key.115" "Key.116" "Key.117" "Key.118" "Key.119" "Key.120" "Key.121" "Key.122" "Key.123" "Key.124" "Key.125" "Key.126" "Key.127" "Key.128" "Key.129" "Key.130" "Key.131" "Key.132" "Key.133" "Key.134" "Key.135" "Key.136" "Key.137" "Key.138" "Key.139" "Key.140" "Key.141" "Key.142" "Key.143" "Key.144" "Key.145" "Key.146" "Key.147" "Key.148" "Key.149" "Key.150" "Key.151" "Key.152" "Key.153" "Key.154" "Key.155" "Key.156" "Key.157" "Key.158" "Key.159" "Key.160" "Key.161" "Key.162" "Key.163" "Key.164" "Key.165" "Key.166" "Key.167" "Key.168" "Key.169" "Key.170" "Key.171" "Key.172" "Key.173" "Key.174" "Key.175" "Key.176" "Key.177" "Key.178" "Key.179" "Key.180" "Key.181" "Key.182" "Key.183" "Key.184" "Key.185" "Key.186" "Key.187" "Key.188" "Key.189" "Key.190" "Key.191" "Key.192" "Key.193" "Key.194" "Key.195" "Key.196" "Key.197" -->

   <Mesh name="soldier2" material="models\soldier2\soldier2.material.xml" batchStart="0" batchCount="1902" vertRStart="0" vertREnd="1898" />
</Model>


EDIT:
Found some related threads

viewtopic.php?f=1&t=1460#p7884


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 15:25 
Offline

Joined: 02.04.2013, 16:49
Posts: 36
Found the settings in the wiki, I guess I missed it the last time I checked. will try this now..

Image

Now only setting up in code is just what I need..


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 15:33 
Offline

Joined: 17.11.2009, 17:00
Posts: 205
Location: Russia, Moscow
I've never worked with morph targets myself, so I am of little help for you.

It seems that .anim file is not produced by the converter and morph targets are written to the geometry file. As for scene file, the comment with morph targets is the correct behaviour.
I think that default parameters in the opencollada exporter can be used. You should only set "Sample animation" in order to convert the animation correctly.
You are right, collada version is 1.4.1 (well, horde supports 1.4, and 1.4.1 only adds physics support, but probably it does not matter)


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 16:12 
Offline

Joined: 02.04.2013, 16:49
Posts: 36
Thanks again Idris. I got no luck with the max exporter but some progress with the blender exporter and it looks like it works well. :)

The only issue left right now is how to play specific keys and run them frame by frame and maybe in a loop..

If I set specific morph keys like this it sets the frame and thats all

Code:
SetModelMorpher( _man, "Key.150", 1.0 )


If I add another morph target string and command, it blends up and I don't get the expected results for vertex animation.

Still trying to find any related vertex or morphing thread..

Edit: Maybe this is the proper way to do it, but I'm not sure and looks like it works :)

Code:
SetModelMorpher( _man, "Key.001", 1.0 ) //play first frame
SetModelMorpher( _man, "Key.001", 0.0 ) //reset blend to none
SetModelMorpher( _man, "Key.002", 1.0 ) //play next frame full blend
SetModelMorpher( _man, "Key.002", 0.0 ) //rinse
SetModelMorpher( _man, "Key.003", 1.0 ) //and
SetModelMorpher( _man, "Key.003", 0.0 ) //repeat
...


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 16:36 
Offline

Joined: 17.11.2009, 17:00
Posts: 205
Location: Russia, Moscow
You should probably try the algorithm that was used in Knight sample - you have two animations, one with weight 1 and other with weight 0. Then, when needed, you blend between two stages. Then animation 1 is discarded, animation 2 becomes animation 1 and animation 3 becomes animation 2.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 16:39 
Offline

Joined: 02.04.2013, 16:49
Posts: 36
Ah yes, I forgot about that. :D Thanks again!

btw, the manual switch I posted above only works with two morph targets, stringing them morphs and scales it somehow.. :/

Code:
SetModelMorpher( _man, "", 0.0 )
SetModelMorpher( _man, "Key.001", 1.0 )
SetModelMorpher( _man, "", 0.0 )
SetModelMorpher( _man, "Key.002", 1.0 )
...


Edit: Setting an empty string instead before the next frame now plays the animation without any problems. :)


Last edited by rasteron on 30.01.2017, 17:08, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 16:59 
Offline

Joined: 02.04.2013, 16:49
Posts: 36
Question, how do you apply MorphTargets to SetModelAnimParams to do the blending if it only works with bone animation? or maybe I am missing something here..


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 30.01.2017, 19:56 
Offline

Joined: 17.11.2009, 17:00
Posts: 205
Location: Russia, Moscow
Yep, it seems that SetModelAnimParams and h3dSetupModelAnimStage only work with animation resources, that contain bone animation. As morph targets (or blend shapes) are mainly used for facial animation, probably main engine developer assumed that another system should be built on top of horde to interpolate between different morph keyframes.

P.S. Check old GameEngine sample that uses morph targets with Xbox 360 pad analog movement:
https://hcm-lab.de/public/Horde3D/trunk ... lfredXpad/


Top
 Profile  
Reply with quote  
 Post subject: Re: Vertex Animation
PostPosted: 31.01.2017, 14:56 
Offline

Joined: 02.04.2013, 16:49
Posts: 36
Thanks Idris! :) I thought of checking out the Game Engine section and remembered that there is this example of morph animation. It looks like it has the same procedure but still a bit confused with the blending part.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group