Forum

Perspective off center get 3d point translate to viewport

HI, i’m using the module perspectivelookAtRect to do the famous Johnny Lee effect


Imagine i got the same setup, i want to get the xyz position of the circle convert to the viewport space in 2d, i tried several transform node like within viewport , but they doesn’t seams to work on an apply transform , i’m using dx11 and really need the 2d coordinate not translate the layer, the classic method with inverse viewprojection doesn’t work also .
Any idea?

multiply by inverse view projection transform and u prolly need a look at as cam, there is also a perspective correction

hi sanch, you can always apply exactly the same transformations as the view/perspective on the renderer to a XYZ1 homogenous position in world space using * (4d) . this gets you the projected coordinates, then divide XYZ by W and you should get the XY of the viewport…

Projected Position.v4p (10.1 kB)

I didn’t really manage aligning it in the same renderer, while looking at the projected position patch, i thought that i don’t need to align them in the perspective off center rendered to do a 2d hittest, so somehow it fixed my problem and manage having the hittest working fine.
Thanks guys