Hello Harry,
You can simply calculate it yourself using these useful code.
set oCamProj = XSIMath.CreateMatrix4
BuildPerspMatrix oCamProj, in_oCam
' =============================================
' Builds the perspective transformation matrix
' from a camera.
' - Glen Fraser (Nov 2002)
' =============================================
sub BuildPerspMatrix( io_mat, in_oCam )
'
' Build the projection matrix
'
if in_oCam.projplane.value then
MatrixFromPPlane io_mat, in_oCam
else
MatrixFromSimpleFOV io_mat, in_oCam
end if
end sub
' =============================================
' Computes the camera projection matrix when
' only the FOV parameter is used (the "normal" case).
' - Glen Fraser (Nov 2002)
' =============================================
sub MatrixFromSimpleFOV( io_mat, in_oCam )
dim fovTan, aspect, near, far, width, height
fovTan = tan( XSIMath.DegreesToRadians( in_oCam.fov.value ) * 0.5 )
aspect = in_oCam.aspect.value
near = in_oCam.near.value
far = in_oCam.far.value
if in_oCam.fovtype.value = 1 then
width = fovTan
height = fovTan / aspect
else
width = aspect * fovTan
height = fovTan
end if
io_mat.Set 1 / width, 0, 0, 0, _
0, 1 / height, 0, 0, _
0, 0, -(far+near)/(far-near), -1, _
0, 0, -2*near*far/(far-near), 0
end sub
' =============================================
' Computes the camera projection matrix when
' the "projection plane" parameters are used.
' - Glen Fraser (Nov 2002)
' =============================================
sub MatrixFromPPlane( io_mat, in_oCam )
dim cx, cy, focal, near, far, width, height
near = in_oCam.near.value
far = in_oCam.far.value
focal = in_oCam.projplanedist.value / 25.4 'convert to inches
width = in_oCam.projplanewidth.value * near / focal
height = in_oCam.projplaneheight.value * near / focal
cx = in_oCam.projplaneoffx.value * near / focal
cy = in_oCam.projplaneoffy.value * near / focal
io_mat.Set 2 * near / width, 0, 0, 0, _
0, 2 * near / height, 0, 0, _
2 * cx / width, 2 * cy / height, -(far+near)/(far-near), -1, _
0, 0, -2*near*far/(far-near), 0
end sub
-Martin
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Harry BARDAK
Sent: Tuesday, October 04, 2005 11:07 AM
To: XSI(at)Softimage.COM
Subject: Camera projection matrix
hi everyone
Is there any method to get the camera projection matrix in script ?
I m a bit lost in the script reference guide.
Thanks.
harry
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi