Friday, March 7, 2008
Back in 1988-1990 I wrote a program in “C” (that’s a programming language), to create stereoscopic drawings. It worked like this: The program will read a data file with the three coordinates of an object in space (X, Y, Z) plus simple instructions for plotting them, and then it would create a stereo pair. A fancy (for 1990 computer technology) interface allowed the user to rotate the image in space, while viewing it in 3d.
This was a nice learning experience for me and took quite a bit of time. See here some examples of the drawings I produced (click to enlarge) and also of the keyboard layout that allowed me to rotate, translate (even in the z-direction, i.e. affecting the stereo window), magnify the image, and also change the two important variables, perspective and parallax.
I am amazed that I did this work 18 years ago and then abandoned it. I am now feeling an urge to resume this, but what tools to use today? The reason I want to resume this work is that I want to study some interesting situations, like “keystoning” using simple drawings instead of actually trying to take pictures.
The program did a lot of things, like scaling, centering, rotating, etc., but the most important operation for 3d purposes is the projection of the point on the “plane of the screen”. Here is how this goes (see figure on the left):
We start with a point in space with coordinates (Xo, Yo, Zo). The observer is sitting at the point Z in the z-axis. If from this point Z we project this point to the projection plane (x, y), we get these projection coordinates: (Xc, Yc). We then move the observer to the Right and Left by B/2 each time (B is the stereo base) and project. Only the x-projections change. In the end, we get two pairs of points (XR, YR=Yc), (XL, YL=Yc). These are the coordinates of our starting point in the right and left projections.
I soon realized that there are two variables involved: One is the stereo base (B), which controls the stereoscopic deviation in the pair. This is clear. The other variable is not so obvious: For a given object, it is possible to come closer and photograph it with a short FL lens, or stay back and photograph it with the long FL lens. The difference between these two situations is the perspective. So I decided to use two variables in my program:
- PAX (Parallax) defined as B/D
- PER (Perspective) defined as S/D
B is the Stereo Base, S is the size of the object, D is the distance of the “camera” from the object.
The Parallax value is what I have called in previous postings “convergence ratio”, B/I in my current terminology. The Perspective variable is inversely proportional to the distance. It is related to the angle of view that the lens sees, which is also related to the size of the film and inversely related to the focal length. We can call this variable the “field of view ratio”.
It is interesting that I note as reasonable values 0.3 for PER (a “normal lens” has a ratio closer to 1. A ratio of 0.3 corresponds to lens of focal length between 80 and 120mm for 35mm film(depending on how you define the film angle of view, horizontal, vertical, or diagonal – the diagonal dimension is normally considered, but in stereo the horizontal is more appropriate, but should this be 36mm or maybe 28mm-7p or 21mm-5p?). So my choice of 0.3 is definitely conservative, meaning that it leads to milder perspective changes.
I also note that 0.06 is a good convergence ratio. Written as a ratio, this is 1/17, which is stronger than the 1/30 rule of thumb for normal stereo photography, but more in line with close-up/macro stereo photography.
It is interesting to study the formulas that give the coordinates of the projected points. There is a variable (which I called M because it looks like a magnification factor since it affects both variables the same degree.) This variable is not constant but it depends on distance (z) only. This expresses the perspective. Object points close to the camera, project further away, i.e. they look larger. The true stereo part of the coordinates depends also on the distance. As expected, objects closer to the camera have more depth. As we have discussed, distance affects all three metric aspects of the stereo image: Size, perspective, and depth.
Two interesting situations: If we set PAX = 0 (B = 0), there is no stereo! The two projections will be identical. The 2d images will have perspective but it will be flat. If we set PER = 0 we can still create a stereo pair, but there will be no perspective. This is known as “orthogonal projection”. Now, to have zero perspective we must be far away from the object, but then how do we have depth? By increasing the stereo base. The bottom line is that by changing our two variables we can create stereoscopic drawings that have various amount of depth (stereoscopic deviation) and perspective.