Question

I was trying to achieve a 3D perspective of a scene as per the position of the user. I read about asymmetric frustum approach to achieve the distortion when the user is not looking from the axis.

The code I used to do off-axis projection is:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
    glFrustum(frustumLeft, frustumRight, frustumBottom, frustumTop, frustumNear, frustumFar);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, headZ);
drawWalls();

When the user is looking at the axis, the scene comes out to be drawn as: enter image description here

When the frustum has been shifted off-axis, the scene comes out to be drawn as: enter image description here

However, what I expected to have come somewhat along the line of the following image (achieved by using gluLookAt and assymetric frustum). enter image description here

For the above program I used assymetric frustum only to specify the viewing volume and on changing the parameters (2nd image) only made the scene to look like a little translated (no distortion). I am wondering if this is the correct behavior or if I'd missed something and not getting the distortion (like 3rd image) in the scene which should have been there. Shouldn't skewed frustum alone be giving me the distorted scene output?

Était-ce utile?

La solution

frustum is like perspective view except the fact that perspective view is always symmetric if you make frustum asymmetric it will show you same effect as in image 2. now what happened to the 2nd image is that it has more view volume to its left side as compared to the right side, so if the image is in the middle it will shift to the right. example as shown here image-frustum more view volume on right as compared to left so it will look like object is pushed towards left because right volume is now occupy more space.

if we change the camera position or where it sees then our object's symmetry changes. Just as if you move your head left or right on the x axis, your computer screen's symmetry will change.feel like bit skewed.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top