0
votes

I'm new to graphics programming. I never had the willpower to sit down and grind through any long OpenGL tutorial, but I got really excited when Apple released Metal and I've come a long ways since. I understand the reasoning behind all the matrix mathematics (although not how they were derived, of course) but I'm having difficulty with my projection. With an orthographic projection matrix, there is no depth so you might as well give up on 3D graphics in that case. However, while my perspective projection seemed to work great at first, I noticed something when I translated my cube away from the center of the projection:

My cube, centered.

After shifting the cube's position.

Now I may be completely wrong, but that distortion does not feel realistic. Maybe after texturing and more complexity it will make sense, but I don't know for sure. In the project, I have a single projection matrix, a world-view matrix, and the cube's model-view matrix. The matrices are multiplied in this order: prMatrix * (wvMatrix * mvMatrix) * <vertex>. Is there some way to maintain objects' proportions no matter where they are within a perspective frustum?

1
Your perspective might just be too strong. Try reducing the field of view angle.Reto Koradi
In most cases, you don't know where your viewer is with respect to your image, so you'll have to guess. This makes choosing the field of view an aesthetic question...comingstorm

1 Answers

2
votes

As reto koradi mentions, the field of view parameter is very important.

If you think of your window as a physical window to the world you're looking at, and your eye as the observation point, you can visualise a pyramid. For a small window, and if you're far enough from the monitor, the pyramid will be very pointy: the field of view is therefore small. I would say you probably drew with a field of view of 90 degrees or more when you really were viewing it at something like 20-30 degrees (since your window is not full screen but rather small).

That incurs a significant distortion, which is required to look correct if you're really looking at your window from up close.