Re: Camera Transformation Matrix

Date : Sun, 22 Apr 2007 10:11:52 +0200
To : XSI(at)Softimage.COM
From : "Abdo Haji-Ali" <abdo.haji.ali(at)gmail.com>
Subject : Re: Camera Transformation Matrix

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.

Sorry, you lost me there :)  What do you mean by "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.

Here's what I found: http://softimage.wiki.avid.com/index.php/Camera_(XSISDK)
In this article the author calculates the perspective matrix and gets the camera transformation matrix (Much like what you said) and then calculates the point in screen space by:
Point(x`,y`,0) = Point(x,y,z) * Inverse_Of_Transformation_Matrix * Perspective_Matrix

What I tried was the following (After normalizing the screen-spaced point):
Point(x,y,z) = Point(x`,y`,0) * Inverse_Of(Inverse_Of_Transformation_Matrix * Perspective_Matrix)

However for some reason the results were somehow "disastrous" :) In a sense that no matter what the points were the resulting world-spaced points were (almost) on the same line!

Also the author said that the "script does not take into account shift-Z zooming". So I was wondering if it would handle correctly all other camera types (Orthogonal, Telephoto…)

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?

I would be happy to wait :)

Thanks alot,
Abdo Haji-Ali
Programmer
In|Framez

Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.