PDA

View Full Version : 8 points of frustum



skyofdwarf
03-07-2003, 08:45 AM
hello, wolrd.
I wonder, how get 8 points of frustum.
I see someone's message
'define a cube in clipping space that fills the space -1 < x < 1, -1 < y < 1, -1 < z < 1 and then transform the cube back to camera space by using the inverse projection matrix'

but,

v[0] = CVector(-1.0f, -1.0f, -1.0f); // xyz
v[1] = CVector( 1.0f, -1.0f, -1.0f); // Xyz
v[2] = CVector(-1.0f, 1.0f, -1.0f); // xYz
v[3] = CVector( 1.0f, 1.0f, -1.0f); // XYz
v[4] = CVector(-1.0f, -1.0f, 1.0f); // xyZ
v[5] = CVector( 1.0f, -1.0f, 1.0f); // XyZ
v[6] = CVector(-1.0f, 1.0f, 1.0f); // xYZ
v[7] = CVector( 1.0f, 1.0f, 1.0f); // XYZ

// inv = inverse(proj)

VtxMultiply(v[0]._v, inv);
VtxMultiply(v[1]._v, inv);
VtxMultiply(v[2]._v, inv);
VtxMultiply(v[3]._v, inv);
VtxMultiply(v[4]._v, inv);
VtxMultiply(v[5]._v, inv);
VtxMultiply(v[6]._v, inv);
VtxMultiply(v[7]._v, inv);

don't work.

and,

v[0~7] = v * inverse(proj*model);

don't work too.

please help me.

thanks any replies.

SirKnight
03-07-2003, 09:17 AM
I don't know if this will help any but if you know the plane equation for each 'face' of the frustum then you can find the points by finding the intersections of all of these planes. Like for example, to find the points of the near plane, find the intersection of the near plane with the left, right, top and bottom planes.

Don't know if all of that means anything to your problem but it's something to ponder anyway. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

-SirKnight

Ysaneya
03-07-2003, 10:16 AM
http://www.fl-tw.com/opengl/frustum.txt

Y.