# How can i get transform matrices?

Hi, i have a question.

https://discourse.panda3d.org/viewtopic.php?t=4110&highlight=view+matrix

Does panda has the DirectX style function such as GetTransform(D3DTS_VIEW) and GetTransform(D3DTS_PROJECTION)?

Hm, what are those functions supposed to do different than the functions in the link you provided?

Can i think that get_projection_mat() is equal to GetTransform(D3DTS_PROJECTION) and
base.cam.getNetTransform().getMat() is equal to GetTransform(D3DTS_VIEW)?

I think so.

(From the Panda3D source code:)

``````_d3d_device->SetTransform(D3DTS_PROJECTION,
(D3DMATRIX*)_projection_mat->get_mat().get_data());``````

So obviously, Panda’s projection mat is D3DTS_PROJECTION.

base.cam.getNetTransform().getMat() is described as “Returns the net transform on this node from the root.”
I don’t know what is the ‘net transform’.

Anyway, I think, base.cam.getNetTransform().getMat() isn’t equal to GetTransform(D3DTS_VIEW).
As I know on, view matrix is consist of translation matrix and rotation matrix.
Translation matrix has bottom row represent negative camera pos.

When camera stay on (100,100,100), “base.cam.getNetTransform().getMat()” returns matrix that has bottom row (100,100,100)

The ‘net transform’ is the transform composed all the way from the root of the scene graph. So you could call it the ‘matrix of the absolute transform of the camera’.

I don’t know exactly what D3DTS_VIEW is supposed to be - do you have a clear description of it somewhere, or so?

Note that base.cam.getNetTransform() is equivalent to base.cam.getTransform(render), which is to say, the transform of base.cam as viewed from render.

If you’re looking for the inverse of this transform, you can either use base.cam.getNetTransform().getInverse(), or the equivalent render.getTransform(base.cam).

At this point, though, it might be worth taking a step back and asking your larger intentions. Panda provides many functions which generally make it unnecessary to query transforms directly like this, and it may well be that whatever you are trying to achieve can be done more simply with Panda’s existing higher-level interfaces.

david