cull library and graphic engine

That projection matrix is the one Panda uses when drawing render2d, which is an orthographic scene and therefore uses an orthographic matrix (as you see).

For drawing the normal 3-D geometry under render it will load a different projection matrix, one which actually includes a perspective transform.

David

Hi
I’m still having problem with the frustum thing, but I’ve also found something strange.
My object always seemed to be in another place in panda and in the lib, even when I used mesh.getMat(render) from panda and applied it directly.
Then I understood why. In panda, the translation component of the matrix is interpreted in the ‘parent’ matrix. and then the rotation part is applied. In the lib, the rotation part is first applied then the translation is made, in the new base.
I checked, to make sure, how matrices are usually handled and found that the translation part is used in the new base, both in directX and openGL.
So my question is: Am I doing it wrong and totally missed the point? If not, why is panda using this convention?

A matrix is a matrix. Matrices are not applied componentwise, translation then rotation or vice-versa; instead, the cells of the matrix are multiplied and added to the components of the point in a specific, rigidly defined way. The result is the composition of the matrix and the point.

Matrix math is exactly the same in Panda and in DirectX and OpenGL. Internally, we’re just copying Panda matrices into DirectX or OpenGL matrices, and it just works properly.

There are some conventions with matrix math that you have to be aware of. For instance, A * B is different from B * A, and the biggest difference between the two is–wait for it–whether the rotation or the transform ends up being applied first. The specific choice of whether A * B or B * A is the way to write the appropriate computation is largely dependent on convention–it depends on whether you view the matrix as row-dominant or column-dominant, and also on the way you write the matrix, and the position in the matrix that the transform component occupies. Panda, DirectX, OpenGL, and many math textbooks all have slightly different conventions here, as discussed in the manual.

So, from your description, I’d guess that you are computing B * A when you should be computing A * B.

David

Some news, and a question.

Thank to your help, I manage to have something working !
The system is not integrated inside panda for now. but works.
One of the latest problems I have was the use of DirectLabel/button or the function showfps. It seems that enable one of these will make my directX queries ineffective.
I’m guessing it’s because of some multipass rendering context somewhere ?

I 've tried to create my own render target for directX to mess less with panda but that doesn’t stop this problem.

Is there another way to show fps ?

There’s no multipass rendering or other fancy tricks involved with DirectLabel or fps meter, but having anything at all in render2d (such as these two 2-d items) will mean that the projection matrix will get changed by Panda during the frame. It gets set initially to the 3-d perspective matrix, and then later to the 2-d orthographic matrix.

David

once again, thank for the info.

I’m wondering if is it possible to commit the modification of panda that I made into the official code ?
It is only a function to get the device reference of direct 3d device in python. I know it’s not very useful for most of the people,…
But if I remember well, I’m supposed to give them back anyway to follow panda3d licence ?

The license has been changed to BSD, very recently. So you’re not obliged anymore to send changes you made.
But of course if you have made a useful change and want to share it, you can post it, and the devs will certainly consider it.