2
\$\begingroup\$

I have moved app from Directx9 into Directx11.

After this upgrade strange thing happened with my world. Objects get skewed and became 2D, also they are clipped in unexpected places.

The two arrows at the image I attached point to my HUD reference frame - three nice cones, arranged to point along the 3 axes, which are supposed to be shown in the lower left corner of the window.

Also you can see that sphere got clipped in difference positions and all objects are 2D. There side and front view. Thanks for your suggestions.

Need to point out that sphere is moving.

enter image description here

I use XMMatrixPerspectiveFovLH to get projection matrix.

Example of matrices:

World
2  0  0  0
0  10 0  0
0  0  1  0
0  0  10 1

View - Identity

Proj
1.72 0    0   0
0    2.41 0   0
0    0    1.  1.
0    0   -1.  0

Both previous images are wrong rendered. Just side view and fromnt view of wrong rendering. Thanks to Tordin i got this: enter image description here

This one is almost correct, only some problems with culling in cones which form reference frame.

EDIT: Question was answered, but nobody wants to frame his comment as an asnwer. First was

Tordin: transpose your matrices. All of them, World, View, Projection. DX11 is Row major and not Colume major like dx9 was

\$\endgroup\$
  • \$\begingroup\$ transpose your matrices. \$\endgroup\$ – Tordin Dec 8 '14 at 13:29
  • \$\begingroup\$ @Tordin you mean world or proj or both? No option works:( \$\endgroup\$ – Yola Dec 8 '14 at 13:36
  • 1
    \$\begingroup\$ All of them, World, View, Projection. DX11 is Row major and not Colume major like dx9 was \$\endgroup\$ – Tordin Dec 8 '14 at 13:48
  • \$\begingroup\$ Still have some problems, but if you want you can write your comment as an answer and i will accept it. Thank you! \$\endgroup\$ – Yola Dec 8 '14 at 13:54
  • \$\begingroup\$ actually, on the image, which is the correct rendering? left or right? \$\endgroup\$ – Tordin Dec 8 '14 at 14:42
2
\$\begingroup\$

Transposing the matrices will fix the issue. As noted by Chuck Walbourn, most of D3D itself expects row-major, but matrix packing for uniforms in HLSL is column-major by default.

This means you could also address the issue using #pragmapack_matrix row_major in HLSL as well.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.