A world to screen transform has two components; the transform from
world into camera space and the perspective divide. The matrix4 for the camera
is held in the camera’s transform, pretty much like any other xsi object and
you’re right, it’s the inverse if the camera transform but with Z
negated. Don’t forget to factor in the object transform.
The perspective divide is no more than a little basic trig, the
result of which normalises the cords. Depending on what you’re trying to
do you may need to clip the result to screen boundaries.
Oddly enough I was just putting the finishing touches to an eps
exporter which does the world to screen transform on meshes to a camera before
exporting. I was considering exposing a couple of the methods as commands too
if there was a demand. I guess there is. Can you wait a day or two?
Or, I’ve built rigs that do screen to world; it should be
possible to do the reverse, I would think.
From:
owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Abdo
Haji-Ali
Sent: 21 April 2007 21:47
To: XSI(at)Softimage.COM
Subject: Camera Transformation Matrix
Greetings,
I was wondering if there's a way to get the transformation matrix of a camera
(or a camera rig)?
What I'm trying to do is to find the world coordinates of a point in screen
coordinates.
My understanding of the camera transformation matrix is that one can use it to
do the following:
Screen(x,y,0,1) = World(x,y,z,w) * Tranformation_Matrix
So I thought that I can use it like this:
World(x,y,z,w) = Screen(x,y,0,1) * Inverse_Of_Tranformation_Matrix
Am I right about this? And how can I get this transformation matrix?
Thanks,
Abdo Haji-Ali
Programmer
In|Framez