• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
BlackJoker

Loaded scene form COLLADA is inverted in DirectX

13 posts in this topic

Hello, 

 

I use COLLADA to load mesh data to my engine and I use my own converter. I know that matrix from COLLADA for each mesh should be transposed for using in DirectX, I also do this, but I faced with the following problem: scene or single object that I load to my engine after conversion to binary file is inverted along Z and Y axis. I multiply one value from each mesh matrix to -1 during transposition and after that position along Y axis is correct, but not along Z axis. I don`t understand how to translate mesh matrices that all of meshes in scene display correctly. For more details please look to attach screen shots from 3ds max and my engine.  







outputMatrixValues[12] = (float)matrixValues[3] ;
outputMatrixValues[13] = (float)matrixValues[7];
outputMatrixValues[14] = (float)matrixValues[11] * (-1);
outputMatrixValues[15] = (float)matrixValues[15] ;

 

 

On screen shot you can see that scene in 3ds mas is in front position, so the position of both cameras (in my engine and 3ds) is correct. I completely confused with this problem. Help me please.

Edited by BlackJoker
1

Share this post


Link to post
Share on other sites

In 3DS, is Y your "up" axis, or is "Z" up?

You probably shouldn't be multiplying individual components of the matrix by -1, but should be scaling an entire axis of the matrix by (-1,-1,-1,-1).

 

DirectX uses whatever handedness you choose to use. You can use it with left handed or right handed matrices.

 

Transposing a matrix does not convert between handedness; it converts between column-major storage and row-major storage. D3D's HLSL and GL's GLSL both operate on column-major storage by default, though fixed-function D3D, and the D3DX helpers often use row-major storage.

 

It also converts matrices that are designed to operate on row-vectors to ones that will work on column-vectors, and vice versa.

Whether you're using row-vectors or column-vectors depends on whether you write vector * matrix, or matrix * vector in your shader code.

Edited by Hodgman
2

Share this post


Link to post
Share on other sites

Hodgman

 

So, if I undertand you correctly, I must multiply meshmatrix to XMFLOAT4(-1, -1, -1, -1)? Am I right?

Edited by BlackJoker
0

Share this post


Link to post
Share on other sites

I think this is the same as if I will multiply each value in the concrete row during transposition. Unfortunately it not works because all meshes became turned inside out and start to rotate when I move camera.

0

Share this post


Link to post
Share on other sites

To convert right hand coordinate system to left hand you have to only scale z axis by -1. scale vector will be Vector3(1,1,-1).

 

If in 3ds max z is up axis (i don't remember if thats the case)  you have to swap z and y values. There should be an option in 3ds max collada exporter ??

Similar option is there for x files and fbx file exporters. Otherwise you can do it at your engine side while loading.

1

Share this post


Link to post
Share on other sites

So simple? I cannot believe.

For Y_UP scaling works great . I want to make my engine and converter very flexible, so I want to learn them to load any variant of exported collada model or models form 3ds max/maya and blender.

 

Regards to Z_UP - there is not enough to swap y and z vertices coordinates or you mean not vertices but values in the matrix?

Edited by BlackJoker
0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0