Page 1 of 1

How to animate fish meshes

Posted: Mon Feb 13, 2012 10:36 am
by robmar
To make a virtual fish tank, there are sources of good fish models, but all are unamimated.

NVidia have a sample that modifies the meshes of the fish, applying a Sin function along the axis to make them "swim".

What would be the best way to do this using Irrlicht?

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 11:34 am
by hybrid
Check the water scene node. It's the same idea, but a simpler mesh structure. I guess you need to find a good way to assign to each vertex a "normalized" position. Applying the offset is notmuch of a problem then. Same goes for vertex shader of course, doesn't really matter which way you apply the offset.

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 11:57 am
by robmar
Thanks for the tip, I´ll do that. I´m really not up to speed at all on mesh manipulation coding. I looked at the NVidia fish sample, but the mesh manipulations were done using functions I wasn´t familiar with, sort of looked complicated!

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 12:05 pm
by robmar
By the way, have you seen the OGRE water demo? It deforms the water mesh to simulate the wave buffeting caused when an objects swims across the surface. Do you think it would be fairly easy to translate these OGRE demos to Irrlicht? I know OGRE might seem to be the competition, but it might be interesting to see the speed difference running them on Irrlicht.

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 12:50 pm
by hybrid
Yeah, the demo uses a very similar approach, just with more complex functions and the ability to touch at a certain position into the water. this is then updated every frame and the effect reduces. Hence, if you always touch at the position the object is, you get the effect of driving waves. The functions are all in, would probably only need a few minor adaptions.

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 12:56 pm
by robmar
thats what I thought. would be useful to a lot of game developers if it was incorporated. (OGRE and Irrlicht at first glance seem quite similar, both have the same philosophy of open platform, even have the same version number, is there a key difference I wonder...)

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 2:24 pm
by serengeor
robmar wrote:thats what I thought. would be useful to a lot of game developers if it was incorporated. (OGRE and Irrlicht at first glance seem quite similar, both have the same philosophy of open platform, even have the same version number, is there a key difference I wonder...)
I've had a look at both of them and to me ogre seams a bit more evolved. And it's not because they have pretty/shiny demos. For example the material system in ogre looks really much better. But irrlicht has its advantages too. It's fairly easy to customize and is quite easy to use even for a beginner.

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 3:55 pm
by hybrid
I don't think that this is the topic of this thread - there are more useless threads where these discussions take place.

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 4:21 pm
by robmar
Well, if I can sort out the fish mesh manipulations, I´ll post it if anyone is interested.

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 4:35 pm
by serengeor
hybrid wrote:I don't think that this is the topic of this thread - there are more useless threads where these discussions take place.
Just wanted to share my opinion on that matter. :|

@robmar: you could probably add some bones in modeling software and create some animations yourself. Shouldn't be too hard to do as fishes aren't very complex (are they?).
As for swimming, you could try doing some random paths, with some checking of course(so they wouldn't swim through the aquarium). Maybe apply some functions that would make them go in more of a curvy motion from start to end point of the path.
Or instead of using random paths you could probably predefine lots of points in the aquarium from which the fishes could choose where to go next.

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 4:59 pm
by robmar
Thanks, the paths I have sorted, using the spline path animator, etc., a friend is trying to animate the fish in blender, but she is really having problems, her fish are all upside down and she can´t figure how to define the centre for rotation, etc. As I haven´t time to learn blender, I thought I´d look for an Irrlicht-friendly mesh manipulation... there is a good sample from NVidia, but it uses their API, so I need to convert it if no one has a better reference. No pain no gain I guess! :)

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 5:37 pm
by serengeor
You need to center mesh at (0,0,0) cordinates to make it rotate around its center.

Re: How to animate fish meshes

Posted: Mon Feb 13, 2012 5:45 pm
by robmar
yes, I know, but the friend that´s helping me with blender seems unable to do it. curious as to why, how difficult can it be! she´s been on it for days, sent mw about 10 versions, all are wrong!