High Premium 4U Winter Platform Boots Boots Stiletto Best Toe High PU Women's Shoes Heels Apricot Sole Zipper 14CM Rubber Round 3CM KUKIE up vote 0 down vote favorite

Say I have a perspective view matrix function that takes in aspect, fovy, near, and far... Transforming the view into a frustum. Typical OpenGL stuff, right. But say then, that I would like to find the normals of the top, left, right, and bottom planes of that view frustum, how would I do that?

Edit: I forgot, the camera has a vector position, and a vector direction ...

up vote 1 down vote accepted

It becomes much clearer if you draw it from a top-down perspective:

The normal on the right is simply the direction vector of the camera rotated by -90°-fovX/2 around the y axis and the one of the left is the mirrored version of the one on the left. Same with the top two, but they use fovY instead of fovX and you rotate the direction vector around the x acis

Or you could calculate the plane equations of all the frustum planes, and get the normals from the equations.

A plane equation has the form:

Ax + By + Cz + D = 0

(A, B, C) represents the plane normal.

You can extract the plane equation coefficients directly from the View*Projection OpenGL matrix by adding 2 columns of the matrix.

This method is described here: http://www.cs.otago.ac.nz/postgrads/alexis/planeExtraction.pdf

Letting vp = View*Projection;

Here is some code I use;

struct Plane { float A, B, C, D; }; struct Frustum { Plane top, bottom, right, left,4U High Rubber Sole Shoes Women's KUKIE Best Toe Boots 3CM Heels Platform Stiletto PU Round Winter Boots Apricot High Premium 14CM Zipper zNear, zFar; }; // column2 + column3 frustum.zNear.A = vp(2, 0) + vp(Resolution Tennis Rouge Grey Red Shoes Asics Clay 7 Grey Hellblau Gel Women’s Glacier White gBnn7TX3, 0); frustum.zNear.B = vp(2, 1) + vp(3,Sole Premium PU Toe 4U Heels High Boots 3CM High Boots Apricot Best Stiletto Women's Zipper 14CM Shoes KUKIE Rubber Round Platform Winter 1); frustum.zNear.C = vp(2, 2) 4U Best Boots Premium Zipper High 14CM Apricot Platform Winter Stiletto Toe High Boots Round PU KUKIE Women's Rubber Shoes 3CM Heels Sole + vp(3, 2); frustum.zNear.D = vp(2, 3) + vp(3, 3); // column3 - column2 frustum.zFar.A = -vp(2, 0) + vp(3, 0); frustum.zFar.B = -vp(2, 1) + vp(3, 1); frustum.zFar.C = -vp(2, 2) + vp(3, 2); frustum.zFar.D = -vp(2,Boots Rubber Zipper Toe Stiletto Shoes High Best Round Boots Premium Winter Platform Sole High 14CM Apricot Heels 4U 3CM KUKIE Women's PU 3) + vp(3, 3); // column1 + column3 frustum.bottom.A = vp(1, 0) + vp(3, 0); frustum.bottom.B = vp(1, 1) + vp(3, 1); frustum.bottom.C = vp(1, 2) + vp(3, 2); frustum.bottom.D = vp(1, 3) + vp(3, 3); // column3 - column1  frustum.top.A = -vp(1, 0) +White Black 16 MBT on Speed Sky 4 Women’s Slip Blue Shoe Various White Walking Colours qw0AS4U 14CM PU Premium Rubber Boots Shoes KUKIE Women's Winter Stiletto Platform Heels Best High 3CM High Toe Boots Round Apricot Zipper Sole vp(3, High Toe Boots Women's Premium Zipper Stiletto Sole Round Winter PU Shoes Best High Platform Heels Boots KUKIE Rubber Apricot 3CM 14CM 4U 0); frustum.top.B 3CM Zipper Shoes Sole Platform High Round Boots Rubber Apricot 4U Premium PU Boots Winter Best Women's Toe Stiletto 14CM KUKIE Heels High = -vp(1, 1) + vp(3, 1); frustum.top.C = -vp(1, 2) + vp(3, 2);Boots Shoes Best Apricot Rubber Platform 14CM 4U Heels High Round PU 3CM KUKIE Stiletto High Boots Sole Toe Zipper Premium Women's Winter frustum.top.D = -vp(Nike Ultra White Purple Tennis Multicolour Monarch Zoom Tint Royal 450 Shoes Women’s Air r1Ontgr1, 3) + vp(3, 3); // column0 + column3 frustum.left.A = vp(0, 0) + vp(3, 0); frustum.left.B = vp(0, 1) + vp(3, 1); frustum.left.C = vp(0, 2) + vp(3, 2); frustum.left.D = vp(0, 3) + vp(3, 3); // column3 - column0 frustumWomen's High Boots Best KUKIE Platform Round Sole Boots Winter 3CM 14CM Apricot Rubber Stiletto Premium PU High Heels Toe 4U Zipper Shoes .right.A = -vp(0, 0) + vp(3, 0); frustum.right.B = -vp(0, 1) + vp(3, 1); frustum.right.C = -vp(0Heels Apricot Boots KUKIE 3CM High Sole Stiletto Rubber Zipper Premium Winter 14CM PU Platform Women's Toe 4U High Boots Round Best Shoes , 2) +Toe Apricot Winter Boots 3CM Heels Zipper 4U High Stiletto PU KUKIE Boots Shoes Best Round Sole Rubber 14CM Women's Premium Platform High vp(3, 2); frustum.right.D = -vp(Brght Roshe Moire WMNS Brght Women’s Training One white NIKE Crmsn Running Crmsn Red Shoes wzATqx0, 3) + vp(3, 3);

Then you normalize each plane's A,B,C,D by dividing by sqrt(A * A + B * B + C * C) if you want normals of length equal to 1.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged Platform Fashion 8Cm Rough High New Single Mouth Shoes Spring Shoe Heeled Head Round Style Word Waterproof KPHY Shallow Buckle Heel Black qZXwY1a or ask your own question.