tmason

09-05-2014, 04:17 AM

Hello,

So I have a rather interesting problem that I just can't figure out; I am importing models using ASSIMP and so far I can get the entire model to import fine but the entire scene is rotated such that +Y from the imported scene is oriented towards the +Z axis of the OpenGL environment.

On the ASSIMP forums the suggested solution was to multiply the root node's matrix by a -90 degree X-axis rotation matrix and since all of the child matrices are multiplied by the root/parent then all would be well.

The problem then is that some of the nodes are oriented correctly but other geometry is off.

Here is my code to rotate the root node:

RootNodeMatrix = glm::rotate(glm::mat4(1.0f), -90.0f, glm::vec3(1.0f, 0.0f, 0.0f)) * RootNodeMatrix;

Then, in the recursive function that processes each node I supply the root/parent node and multiply like so:

CurrentNodeModelMatrix *= (*ParentNodeModelMatrix);

With this, as mentioned I get some of the geometry oriented correctly but a lot of it is still off.

With JUST multiplying the Child Node Matrix by the Parent Node's matrix everything is OK relative to each other but I have the wrong "up" direction.

Is there something simple I am missing here?

Thank you for your time.

So I have a rather interesting problem that I just can't figure out; I am importing models using ASSIMP and so far I can get the entire model to import fine but the entire scene is rotated such that +Y from the imported scene is oriented towards the +Z axis of the OpenGL environment.

On the ASSIMP forums the suggested solution was to multiply the root node's matrix by a -90 degree X-axis rotation matrix and since all of the child matrices are multiplied by the root/parent then all would be well.

The problem then is that some of the nodes are oriented correctly but other geometry is off.

Here is my code to rotate the root node:

RootNodeMatrix = glm::rotate(glm::mat4(1.0f), -90.0f, glm::vec3(1.0f, 0.0f, 0.0f)) * RootNodeMatrix;

Then, in the recursive function that processes each node I supply the root/parent node and multiply like so:

CurrentNodeModelMatrix *= (*ParentNodeModelMatrix);

With this, as mentioned I get some of the geometry oriented correctly but a lot of it is still off.

With JUST multiplying the Child Node Matrix by the Parent Node's matrix everything is OK relative to each other but I have the wrong "up" direction.

Is there something simple I am missing here?

Thank you for your time.