MapViewToScreen matrix

This widget could not be displayed.

MapViewToScreen matrix

Anonymous
Not applicable

Good day, I need help with getting access to matrix that deforms 3d coordinates from world space to screen space... Each point can be transformed in 3ds max sdk by MapViewToScreen function of ViewExp, but if I wish to project a large set of objects, is it possible to get the matrix once and then optimize the deformation via vector operation?

 

Thanks in advance!

Tatiana

0 Likes
Reply
Accepted solutions (1)
666 Views
6 Replies
Replies (6)

istan
Advisor
Advisor
0 Likes

Anonymous
Not applicable

Thanks istan, 

No, it does not. This is the transform from world coords to the coordinates of the camera, but not the projection to the screen, 

 

actually you first transform your points from world space coordinates with AffineTM matrix to camera coordinate system

(put origin at camera and z aligned with viewing direction, y with up) but then you need to project from 3D to screen with MapViewToScreen,

and do it per point!

 

I wonder if I could simulate the computations to get the matrix exactly or just get some interface to get the projection matrix.

 

Thanks!

Tatiana

0 Likes

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

where is the problem? you have a view (ViewExp*) -> graphic window  (GraphicsWindow*) -> its transform ... what do you need extra?

 

 

Anonymous
Not applicable

Sounds as just what I need, Thank you, Denis!
Shall try it...

0 Likes

Anonymous
Not applicable

I must admit, I am still lost... What matrix combination do I need to get effect like 

vp->MapViewToScreen(pt);

where vp is ViewExp*, pt is a point in a camera coordinates (not projected, i.e pt = AffineTM * ObjectTM * vLocalPt)? 
let's say I have 1200x720 viewport, then the result should be x in [0, 1200], y in [0, 720]?

 

Thank you!

0 Likes

Anonymous
Not applicable

Got it! GetCameraMatrix transforms vertex to NDC, which is even better!

 

Thanks again Denis!

0 Likes