View Full Version : viewing volume problem

ozone01

11-02-2002, 07:31 AM

Hi,

I am trying to make a program that uses projective texturing. I works quite well, but there is still one problem. I would like to visualize the vieuwing volume of the projector. Can this be done by transforming a wirecube and how do you do this?

Asgard

11-02-2002, 07:37 AM

There are various ways to do that.

You could extract the plane equations of the 6 frustum planes from the projection matrix, then intersect always 3 planes with each other to get the 8 points of the frustum in camera space.

Another option would be to 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 (or possibly some compound matrix that contains the projection matrix, depending on what coordinate system you need).

ozone01

11-02-2002, 08:13 AM

forgive me my ignorance but what do you mean by clipping space? I only know object, world or cameraspace.

Asgard

11-02-2002, 10:01 AM

I mean post-projection space, or clip coordinates.

To tell you the truth, I haven't thought through the second option thoroughly, so your best bet is to simply extract the frustum planes from the projection matrix, of which I definitely know that it works.

The second option might require some more calculations that I haven't thought of. I'm not really sure, but I think you have to divide by w after back-projecting the cube to camera space. I might be wrong though http://www.opengl.org/discussion_boards/ubb/smile.gif

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.