Re: Camera projection matrix

Date : Thu, 06 Oct 2005 12:00:01 +0930
To : XSI(at)Softimage.COM
From : benp <benp(at)rsp.com.au>
Subject : Re: Camera projection matrix
no, but the division is just to remap the values into normalised screen space coords (which basically comes down to the impementation of the specific context in which you need to use the results).
the entire transformation is handled by the matricies.


btw, i'm sure the matrix representation of your dog is pretty ugly ;)


kim aldis wrote:

But the division isn't part of the matrix,no?

Would you give me the matrix representation of my dog? ;)





-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Brent McPherson
Sent: 05-October-2005 13:53
To: XSI(at)Softimage.COM
Subject: RE: Camera projection matrix


You can represent everything by a 4x4 matrix.

In hardware it is broken down into two stages because they need to clipping to the view volume. In software when transforming points between screen <-> world space clipping is not necessary so I always like to use a single 4x4 matrix that takes points directly to screen space.

In this scenario a world point is represented as a 4D point (x,y,z,1) which gets transformed (by the 4x4 projection matrix) matrix to (x',y',z',w). All that remains is a simple division by w to get the final screen coordinates (x'/w, y'/w)
--
Brent


-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of kim aldis
Sent: 05 October 2005 12:49
To: XSI(at)Softimage.COM
Subject: RE: Camera projection matrix


But surely the projection isn't a matrix. The world to camera transform can be represented as a matrix but the perspective divide can't, can it? Then there's the view frustrum clip ...



-----Original Message-----
From: owner-xsi(at)Softimage.COM
[mailto:owner-xsi(at)Softimage.COM] On Behalf Of Martin Bélanger
Sent: 04-October-2005 16:52
To: XSI(at)Softimage.COM
Subject: RE: Camera projection matrix

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



---
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






---
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


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.