Loaded scene form COLLADA is inverted in DirectX

Started by
12 comments, last by iskatsu 11 years, 1 month ago

Hello,

Could you please explain how to swap z and y axis for mesh in my engine during loading it? With your help I understood how to load sceene with Y_UP, I also solve problem with Z_UP, but a little tricky.


XMFLOAT4X4 cm;
            cm._11 = 1;
            cm._12 = 0;
            cm._13 = 0;
            cm._14 = 0;
            cm._21 = 0;
            cm._22 = 0;
            cm._23 = 1;
            cm._24 = 0;
            cm._31 = 0;
            cm._32 = 1;
            cm._33 = 0;
            cm._34 = 0;
            cm._41 = 0;
            cm._42 = 0;
            cm._43 = 0;
            cm._44 = 1;

            XMMATRIX matr = XMLoadFloat4x4(&cm);
            
            meshInfo->meshPosition = XMMATRIX(n);
            meshInfo->meshPosition = matr * meshInfo->meshPosition* matr;

here i use some matrix (I don`t know what this matrix is exactly), but aftrei multiply it with mesh matrix which I got from COLLADA, in this sequence meshInfo->meshPosition = matr * meshInfo->meshPosition* matr; and then during loading swap y and z coordinates for each vertex and normal, only then scene look correct,

but I want to ask is there any other more simple (just using matrices without swapping y and z vertices) way to load scene correctly?

Advertisement

but I want to ask is there any other more simple (just using matrices without swapping y and z vertices) way to load scene correctly?

A rotation matrix that rotates 90 degrees on the x-axis will flip y/z coordinates.

I think there is no correct way to do this only with matrices, but I could be wrong

Swap y and z coordinates of each point in the model.

This topic is closed to new replies.

Advertisement