# extract frustum corners

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

## Recommended Posts

Hello. I have some problems extracting the corners of a frustum. The frustum is given by a 'modelview' and a 'projection' matrix. The points are calculated as:
void frustum::calc_points(const mat4 &modv, const mat4 &proj) {
mat4 mvp = modv * proj;
mat4 imvp = inverse(mvp);
_points[0] = transform_point(imvp, vec3( 1.0f,  1.0f, -1.0f);
_points[1] = transform_point(imvp, vec3(-1.0f,  1.0f, -1.0f);
_points[2] = transform_point(imvp, vec3( 1.0f, -1.0f, -1.0f);
_points[3] = transform_point(imvp, vec3(-1.0f, -1.0f, -1.0f);
_points[4] = transform_point(imvp, vec3( 1.0f,  1.0f,  1.0f);
_points[5] = transform_point(imvp, vec3(-1.0f,  1.0f,  1.0f);
_points[6] = transform_point(imvp, vec3( 1.0f, -1.0f,  1.0f);
_points[7] = transform_point(imvp, vec3(-1.0f, -1.0f,  1.0f);
}


This calculation does not give the correct frustum corners in world coordinates.

##### Share on other sites
Assuming you're following OpenGL's notational conventions (e.g. using column vectors), you might try:
mat4 mvp = proj * modv;

##### Share on other sites
Quote:
 Original post by jykAssuming you're following OpenGL's notational conventions (e.g. using column vectors), you might try:mat4 mvp = proj * modv;

Did that (thanks). It looks better but still something is not entirely correct.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633682
• Total Posts
3013308
×