View Full Version : Visualizing Frustum

Shade

04-15-2006, 10:14 AM

I have a simple frustum defined by six planes:

float md_arrFrustumPlanes[6][4];If any one has a code snip for visualizing a frusum I would be very happy.

andras

04-15-2006, 12:37 PM

The best way to visualize a frustum is to transform a unit cube with the inverse projection matrix.

Shade

04-16-2006, 05:24 AM

Well that is less flexible than what I aim for. This way you can only render the entire view frustum or nothing. I as said to render the invidual planes.

Overmind

04-16-2006, 06:21 AM

Then just render a single side of the unit cube, transformed by the inverse projection matrix ;)

The other possibility is to intersect 3 planes to generate a vertex. For example, when you want to visualize the near plane, intersect the near plane with the top, left, bottom and right planes (pairwise) to generate the 4 vertices.

If you do the math, you'll get a system of linear equations. Each plane is actually a linear equation in 3 variables, so with 3 planes you have 3 equations in 3 variables per vertex. That has to be done for every combination of 3 planes (that are not opposite), giving 8 vertices.

Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.