# Projection left, right, top, bottom, znear, zfar

This topic is 4652 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys I wish to split a projection matrix into sections, so I can render high-res screenshots of my game. I try to do this by retrieving the left, right, top, bottom, znear, zfar parameters from the projection matrix, partitioning into however many sections by interpolating between them, then recreating the projection matrices using these interpolated parameters. My function ExtractPoints returns the 8 corners of the view frustum from an arbitrary matrix, and my ExtractParameters function returns the left, right, bottom, top, znear and zfar parameters from an arbitrary matrix. These work fine when used on a view.projection concatenation, but do not give the desired results when used on just a projection matrix. To ensure that it wasn't my splitting code at fault, I tried it as in the pseduo code below: projection = CreateMatrix(left, right, bottom, top, zNear, zFar) left2, right2, bottom2, top2, zNear2, zFar2 = ExtractParameters(projection) projection2 = CreateMatrix(left2, right2, bottom2, top2, zNear2, zFar2) projection and projection2 are different matrices, as left, left2, right, right2 etc are different values. I hope that's clear...

##### Share on other sites
Well, you need to know how the matrix is actually built. Once you have that build it by hand and check it against what you're getting. You might find, for example, that the actual matrix is the transpose of what you thought it would be. Once you're sure the matrix is laid out as you thought build it symbolically and extract the components, i.e. use l, r, t, b, n, f rather than actual numbers. You may find the extraction is wrong but that simple manipulation of what you have will give you want you want, i.e. l-r and r-l rather than r and l.

##### Share on other sites
Looks like your CreateMatrix and ExtractParameters functions may be broken. Both the D3D and OpenGL docs describe how the projection matrix is built. Compare that to your CreateMatrix function. Once you have verified that your CreateMatrix function works correctly, you can use test cases to figure out what is wrong with the ExtractParameters function.

1. 1
Rutin
26
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 14
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631757
• Total Posts
3002126
×