Jordan Bonser
  • Home
  • CV
  • University Work
    • Second Year Work >
      • Top-Down Shooter
    • Third Year Work >
      • Terrain Analysis Project >
        • Terrain Analysis Tool
        • Game Demonstration
      • Post Processing
      • Android Application - Sports Centre
  • Projects
    • Unity Development >
      • Lerpz Tutorial
      • Dare to be Digital Entry - "Lit"
      • Unity Game
    • Geometry Instancing
    • Road to Eldorado
    • Level Editor
    • OpenGL Work
    • JBEngine
  • Blog
  • Tutorials
    • Flask Session Timeout

Development Blog

Loading Multiple Animations

18/12/2013

4 Comments

 
Since finishing the first working version of the animation I started testing out different file types and cleaning up a lot of my code. Since then I have been attempting to implement multiple animations and animation blending.

First off I have created an "AnimationTrack" class which hold all the keyframe data for one animation regarding one bone. That is slightly confusing to say, basically the bones no longer hold the keyframes for an animation, instead they have a number of tracks which hold the keyframe data for each specific animation. This way multiple animations can be realted to one bone hierarchy. 

Second of all I needed some way of importing multiple types of animation, which wasn't so easy. Assimp supports multiple animations and with the right files it is fairly straightforward. The problem is that I am using 3DS Max and ideally collada files for all my models and the combination of the two has been a pain. Apparently 3DS Maxx doesn't allow you to easily export multiple animations in one collada file(Why?? I have no idea!!). This meant I would either have to use a different file type such as ".x" or find some way to get around this issue. After some searching I found that there are ways in which people have had to get round this before, specifically for importing into the Unity Engine.

The way in which unity deals with this is to have all animations represented on a single timeline in 3DS Max and then using the Start and End KeyFrames breaks the animations up when loading. Personally I don't like this as it means you can't just load a file and it will all work perfectly. 

The approach I thought of was to have seperate collada files all with the same bind pose model but with different animations inside. This way when the file is loaded it will check to see if the model already exists and if it does just check to see if there is a new animation and just load that. That way all you ever have to do is load as many or as little files as you need, i.e. the animations you will need and you aren't altering one file all the time to change one animation. This approach has caused more trouble than I thought, mostly due to 3DS Max once again. Max was naming all the animations the same when being exported and also often didn't supply a name for the RootNode of the scene, which was what I was using to check the model was the same.

Ideally I would want my approach to work but I decided I had spent too much time on it and instead implemented the "All in one timeline" approach. I have now got this working and although I do have to provide extra input it works fairly well. There is more than likely going to be extra input for things like bone masking and specifying blend points so It doesn't seem too bad, also it seems to be the standard way that artists do it so that is always a benefit.

I have got the animations loaded in this manner now, although there isn't much to show. I should shortly have a demo of multiway blended animations.

Keep Coding :)
4 Comments
Jeremy
5/1/2014 12:22:00 pm

I have a questions about your skeletal animation. When you load the animation using assimp, are you placing all the data gathered into your own structure and then using that to animate or are you constantly reading from the assimp library during animation? for example when you are looking for bone transformations.

Reply
Jordan Bonser
6/1/2014 06:13:04 am

Hi Jeremy,
Yes I load all the data from assimp just once and then store it all in my own classes. communicating with assimp constantly would slow things down considerably as I would need to convert from Assimps vectors and matrices to my own every tick of the animation.

I was thinking about doing a full tutorial for skeletal animation but there are already some fairly decent ones out there.

Try: http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html

That one is fairly good for understanding the principles of loading and running the animations but doesn't really help much with the design of your own classes/data structures.

Hope that helps somewhat, if not I can maybe look into creating a tutorial :)

Reply
Jeremy
6/1/2014 08:46:09 am

I have already looked at that tutorial. I actually have been studying this one which i prefer between the two because they are doing what you have accomplished which is to just store the information rather then animate using the assimp library.

http://antongerdelan.net/opengl/skinning.html

But the problem I am currently having is wrapping my head around the node system in the way they store the animation information in assimp. Using the information in my own scene graph would not be hard at all but it just getting the information from assimps set up i find the most difficult frankly lol. A tutorial would be nice I think but I personally would just be interested in the process of recovering the animation into a data structure of my own. I am able to load meshes and textures its the animation info that is killing me lmao any ways thanks for the quick response and congrats on figuring it out lol.

Jordan Bonser
8/1/2014 03:00:18 am

Hey Jeremy,
Yeah the assimp stuff is store in a really peculiar way, the best way is to break it down into small tasks. First of all get the bone hierarchy, then create the animations and gather the key frame data and finally gather the per vertex bone data.

The bone hierarchy is a case of getting one of the bones by finding the first mesh that has bones in it. Using one of the bones from this mesh you want to follow the bones parent pointers until it has the root node as it's parent. This will normally give you the root bone of the skeleton. From this you can create the hierarchy by recursively iterating the child bones and creating your own data structures for them.

The Animations and key frames should be easy enough once you have the bone hierarchy in your own data structure. It is a case of using the aiNodeAnim that has the same name as one of your bones and then generating the key frames from the Position/Rotation/Scale keys.

The vertex bone data is slightly confusing as the info you need are stored in different structures.The way I do it is for each vertex I iterate through all of the bones in the mesh and get the weights. I then Iterate the weights and compare the vertex ID against the current vertex and if there is a match then I create one of my own data structures for this and add it to a list.

It has been quite confusing to write down so I hope I haven't confused you more. If there is a particular part that you want explaining then please ask.

Cheers :)

Reply



Leave a Reply.

    Archives

    May 2020
    April 2020
    January 2020
    November 2019
    October 2019
    September 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    August 2018
    July 2018
    June 2018
    March 2018
    January 2018
    June 2017
    February 2017
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    February 2016
    January 2016
    December 2015
    November 2015
    September 2015
    August 2015
    July 2015
    June 2015
    March 2015
    January 2015
    November 2014
    October 2014
    September 2014
    August 2014
    July 2014
    June 2014
    May 2014
    February 2014
    January 2014
    December 2013
    November 2013
    October 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    October 2012
    September 2012
    August 2012
    July 2012
    June 2012
    May 2012

    Categories

    All
    2D
    3rd Year Project
    Agile
    Android
    Angular
    Animation
    API
    Apple
    Apps
    Arden
    Async
    Awesomium
    C#
    CI/CD
    Clean Code
    CMake
    Cocos2d-x
    Colour Match
    Compilers
    Cross Compiling
    Cross-Compiling
    Databases
    Design
    Development Tools
    Docker
    Electronics
    Examples
    Flask
    Flask-Login
    Fmod
    Game Development
    Godot
    GUI
    Hackathon
    Hacktoberfest
    Hardware
    Home Life
    IBM
    Inspired Gaming
    Instancing
    Ios
    Javascript
    Jbengine
    Kata
    Level Editor
    Linux
    Microsoft
    Mobile Development
    Monogame
    Moodster
    Motivation
    Networking
    Objective C
    Opengl
    Open Source
    Organisation
    Physics
    Physx
    Pi
    Planning
    Post Mortem
    PyGame
    Python
    Quart
    Quasar
    RakNet
    React
    Road To Eldoarado
    Scripting
    Scrum Master
    Sessions
    Session Timeout
    Social
    Sound
    Space Invaders
    Squash Game
    Squash Game
    Streaming
    TDD
    Team Leading
    Test
    Test Driven Development
    Travis
    Unity
    Unity Development
    VSCode
    Vulkan
    Web Applications
    Worklife
    WSL
    XML
    XNA / C#

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Home
  • CV
  • University Work
    • Second Year Work >
      • Top-Down Shooter
    • Third Year Work >
      • Terrain Analysis Project >
        • Terrain Analysis Tool
        • Game Demonstration
      • Post Processing
      • Android Application - Sports Centre
  • Projects
    • Unity Development >
      • Lerpz Tutorial
      • Dare to be Digital Entry - "Lit"
      • Unity Game
    • Geometry Instancing
    • Road to Eldorado
    • Level Editor
    • OpenGL Work
    • JBEngine
  • Blog
  • Tutorials
    • Flask Session Timeout