Hi all,
I just found that vwright, which looked like the perfect tool to support
stereoscopic image pair generation, generates a new view by simply
moving the view-point -vp. This does not consider the fact that our eyes
(hopefully) are able to focus on an object, not looking parallel into
infinity. So my resulting frames do not really match (I tried it and it
looked ugly...). Paul Bourke provides a great page explaining the
background of such stereo pairs on his website:
http://paulbourke.net/miscellaneous/stereographics/stereorender/
To correct this, I would propose to manipulate the -vs and -vh
parameters in the view file generated by vwright. I am not that great in
doing reprojections, but from what I understand, this should work. I
have made a simple sketch to visually explain what I attempted to do
(and probably what I did wrong):
web-browsers with svg-support
http://static.larsgrobe.de/stereoscopic_vwright.svg
pdf of the same sketch
http://static.larsgrobe.de/stereoscopic_vwright.pdf
Here is my approach:
e [scene units]: eye seperation
is given as input to vwright, known
f [scene units]: distance from either eye point to the image plane
can simply be calculated from view direction vector vd_x, vd_y, vd_z:
f = sqrt(vd_x^2+vd_y^2+vd_z^2)
alpha [degrees]: half horizontal view angle
can simply be calculated from view's vh: alpha = vh/2
a [scene units]: alpha projected on the image plane
a = f * tan(alpha)
1) Calculate horizontal shift value vs for views:
vs [] : shift fraction (eye separation e / projected image width 2*a)
can be calculated from above as vs = e / 2*a
For the left view, I modify vs as above, for the right view I use its
negative value.
2) Correct the horizontal field of view vh for views:
The stereoscopic image can be displayed only the overlapping image area
for both views. Thus we need to cut the left border from the left and
the right border from the right view.
beta [degrees]: the angle corresponding to this border (having the same
width as the eye separation, but being located in the image plane)
calculated as beta = alpha - atan ( (a-e)/f )
This allows calculating the corrected horizontal view angle vh_corr,
which will replace the vh in my view files:
vh_corr [degrees]: corrected horizontal field of view
as vh_corr = vh - beta
3) The full procedure:
- take a view, derive left and right views from it by running vwright
(+/-) e/2
- calculate vs and vh_corr and replace the corresponding values in both
views
- render, take on your glasses, and enjoy stereoscopic 3d images....
I hope this is correct, for me it gave results looking much better then
those by simply using vwright's view parameters. I think that having
this in vwright as an option (either active by default, or, to preserve
backwards compatibility, switched by e.g. -s as stereographic) would
make rendering of stereo pairs with Radiance much more fun.
Any comments? Cheers, Lars.