I'm a newbie in assimp and openGL. I'm trying to import .fbx or .dae formatted file to openGL via assimp. Importing skeletal animation was kind of easy. Lots of introductions and sample projects helped me to run several files properly. But, in case of none skeletal animation(does it named 'vertex animation'?), which has no bone, I can't find any of source, instructions, including assimp tutorials. Or, I'm not sure it is even possible, maybe assimp doesn't support this kind of animation. Is there any recommendable project for non skeletal animation? Any single comment, will be helpful. Thanks.


1 Answer 1


It is actually easier than you think. The way this works is really simple, it is a lot like video.

So, when you watch a video(I am sure you know this already but just as a reminder) you are not actually watching a moving image, instead you are watch a lot of images getting displayed one after the other REALLY fast, faster than your eye can see(There is a video from gamespot called "Do we need 60 fps" if you are interested).

Non-skeletal animation works in the same way. Let's say you have an animation with 240 frames, and each frame is a file in a directory. Let's also say that your computer runs at 60 fps. All you have to do is, for every next frame load the next model frame and draw that. In simple words, each time you draw to the screen you move to the next model frame.

But, this is only if you are running at 60fps. If you are running at lower fps, like 30fps, the animation will appear to slow down. I will not explain this a lot because since you have already done skeletal animation, I assume that you have dealt with this problem. Solution: find out have much time has passed since the last frame and if that is bigger than the time that each animation frame takes, move to the next frame. Some thing like this:

 int framesToMove = (int)((lastFrameTime - currentFrameTime) / animFrameTime)

If you do not understand, ask me.

Advantage: A lot more performance friendly, than skeletal animation.

Disadvantage: Requires A LOT more memory.

Recommendation: Use skeletal animation for complicated animations, like character movement, and for animation with complicated models that have many vertices, and use non-skeletal animation for simpler models, like a gate opening animation.

Here is some example code:

#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>

Assimp::Importer importer;

const aiScene* scene = importer.ReadFile(("./res/models/" + fileName).c_str(), aiProcess_Triangulate | aiProcess_GenSmoothNormals |  aiProcess_FlipUVs |  aiProcess_CalcTangentSpace);

if(!scene) {
    std::cout << "Mesh load failed!" << std::endl;

const aiMesh* model = scene->mMeshes[0];

std::vector<Vector3f> positions;
std::vector<Vector2f> texCoords;
std::vector<Vector3f> normals;
std::vector<Vector3f> tangents;
std::vector<unsigned int> indices;

for(unsigned int i = 0; i < model->mNumVertices; i++) {
    const aiVector3D pos = model->mVertices[i];
    const aiVector3D normal = model->mNormals[i];
    const aiVector3D texCoord = model->HasTextureCoords(0) ? model->mTextureCoords[0][i] : aiVector3D(0.0f, 0.0f, 0.0f);
    const aiVector3D tangent = model->mTangents[i];

    positions.push_back(Vector3f(pos.x, pos.y, pos.z));
    texCoords.push_back(Vector2f(texCoord.x, texCoord.y));
    normals.push_back(Vector3f(normal.x, normal.y, normal.z));
    tangents.push_back(Vector3f(tangent.x, tangent.y, tangent.z));

for(unsigned int i = 0; i < model->mNumFaces; i++) {
    const aiFace& face = model->mFaces[i];
    assert(face.mNumIndices == 3);
  • \$\begingroup\$ Actually, what I'm having trouble is 'assimp' import data structure which contains animation info (or, any single frame?) I have to access. I can animate files with skeleton animation, or visualize static object without skeleton(only mesh object). But when it comes to non-skeleton animation, I just can't figure out where the animation is stored of the scene. \$\endgroup\$
    – Kim.K
    Jun 12, 2016 at 14:10
  • \$\begingroup\$ As I know, using assimp, in skeletal animation, the animation information is attached to bone(or part of bone). So, I think, non-skeletal animation which has no bone, would have different location of animation or abort to having animation. Which one is true? Is it possible to import non-skeletal animation through assimp? I need verification that assimp does import non-skeletal animation and example of that. \$\endgroup\$
    – Kim.K
    Jun 12, 2016 at 14:10
  • \$\begingroup\$ I've read some discussion about 'assimp & vertex-animation'. It says that couple of years ago, assimp didn't support vertex-animation. Maybe, assimp developers thought it was not that critical, so left it undone. In this case, interpolation from several obj file would be better than importing it from animation-containing-file. If you knows about vertex-animation (non-skeletal animation) importing files via assimp, or other 3d file importer capable of vertex-animation to openGL, please let me know. Any of the working sample file would be helpful mostly. Thanks. \$\endgroup\$
    – Kim.K
    Jun 12, 2016 at 14:10
  • \$\begingroup\$ @Kim.K I have updated the post and now it includes some example code \$\endgroup\$
    – J22o
    Jun 12, 2016 at 15:13
  • \$\begingroup\$ It seems like contains only the very first frame like static model. Which variable has information about 'following frames'? If this code block works fine with 'vertex animation', please teach me. Thanks for your concern. \$\endgroup\$
    – Kim.K
    Jun 14, 2016 at 5:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .