### Welcome, Unregistered.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 29-May-2009, 16:28 #1 maxest Registered   Join Date: Oct 2008 Posts: 7 Extracting frustum planes from orthographic projection I extract perspective-frustum planes by first extracting the corners, which are computed in this manner: Code: ``` viewFrustumCorners[0] = CVector3(-1.0f, 1.0f, 0.0f); viewFrustumCorners[1] = CVector3(1.0f, 1.0f, 0.0f); viewFrustumCorners[2] = CVector3(1.0f, -1.0f, 0.0f); viewFrustumCorners[3] = CVector3(-1.0f, -1.0f, 0.0f); viewFrustumCorners[4] = CVector3(-1.0f, 1.0f, 1.0f); viewFrustumCorners[5] = CVector3(1.0f, 1.0f, 1.0f); viewFrustumCorners[6] = CVector3(1.0f, -1.0f, 1.0f); viewFrustumCorners[7] = CVector3(-1.0f, -1.0f, 1.0f); for (int i = 0; i < 8; i++) { viewFrustumCorners[i] = (CVector4)viewFrustumCorners[i] * viewProjTransformInversed; }``` So I start with clip-space and go back to world-space. Now I need to do the same thing but for frustum that is not perpsective, but orthographic. So I tried do it in the same way. Unfortunately I don't get proper results. Could you give me some clues on how to extract the ortho-frustum corners?
 01-Jun-2009, 23:23 #2 Nick Senior Member   Join Date: Jan 2003 Location: Ottawa, Ontario Posts: 1,783 They are homogeneous coordinates, so they have 4 components. To go from 4D vectors to 3D vectors, just divide the first three component by the last one. Conversion from 3D to 4D is done by setting the last component to 1. Code: ```CVector4 viewFrustumCorners[8]; viewFrustumCorners[0] = CVector4(-1.0f, 1.0f, 0.0f, 1.0f); viewFrustumCorners[1] = CVector4(1.0f, 1.0f, 0.0f, 1.0f); viewFrustumCorners[2] = CVector4(1.0f, -1.0f, 0.0f, 1.0f); viewFrustumCorners[3] = CVector4(-1.0f, -1.0f, 0.0f, 1.0f); viewFrustumCorners[4] = CVector4(-1.0f, 1.0f, 1.0f, 1.0f); viewFrustumCorners[5] = CVector4(1.0f, 1.0f, 1.0f, 1.0f); viewFrustumCorners[6] = CVector4(1.0f, -1.0f, 1.0f, 1.0f); viewFrustumCorners[7] = CVector4(-1.0f, -1.0f, 1.0f, 1.0f); for (int i = 0; i < 8; i++) { viewFrustumCorners[i] = viewFrustumCorners[i] * viewProjTransformInversed; viewFrustumCorners[i].x /= viewFrustumCorners[i].w; viewFrustumCorners[i].y /= viewFrustumCorners[i].w; viewFrustumCorners[i].z /= viewFrustumCorners[i].w; }``` That should do it.
 03-Jun-2009, 12:00 #3 maxest Registered   Join Date: Oct 2008 Posts: 7 Yes, I know that. And my overloaded * operator does that automatically. As I said, it works for perspective projections, but doesn't want for ortho
 03-Jun-2009, 15:31 #4 Nick Senior Member   Join Date: Jan 2003 Location: Ottawa, Ontario Posts: 1,783 Then just set a simple orthographic projection matrix for which you know the frustum planes, and check the calculations by hand. Somewhere something is not working the way you expect it to work. So verify things step by step at a lower level.
 03-Jun-2009, 16:12 #5 maxest Registered   Join Date: Oct 2008 Posts: 7 I guess I've just found the problem. My function which calculates the inverse of a matrix returned the same matrix. It didn't compute the inverse because determinant of ortho matrix is near 0, and I have an "if" which says that in this case the computations are to be skipped, because it is not possible to compute inverse matrix from a singular input matrix. Yet ortho isn't singular (althought it's determinant is very small)

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News Forums     Beyond3D News         Press Releases         Beyond3D Articles Core Forums     3D Architectures & Chips         3D Beginner's Questions     3D Technology & Algorithms         3D Programming & Tools     3D Hardware, Software & Output Devices         Video Technology, Displays, & HTPC     3D & Semiconductor Industry     GPGPU Technology & Programming Embedded 3D Forums     Console Forum         Console Technology         Console Games             PC Games     Handheld Gaming     Handheld Technology     CellPerformance@B3D PC Forums     Hardware & Software Talk         Politics & Ethics of Technology         Unix, Mac, & BSD (3D)     Processor & Chipset Technology     Purchase Decisions Help     PC Games         Console Games Site Forums     General Discussion     Folding For Beyond3D Team #32377     Industry Jobs     Site Feedback Beyond3D Hall of Fame     Pre-release GPU Speculation     General 3D Technology     Consoles     Other

All times are GMT +1. The time now is 05:22.

 -- vB3D -- vBulletin Default Style Contact Us - Beyond3D - Archive - Top