# vwright and stereoscopic image generation

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.

Hi Lars,

I only ever created stereo slide pairs using vwright, in which case, simply moving the slides closer together a small amount alleviated any discomfort. It amounts to the same as -vs (modulo the image borders).

I wrote vwright before introducing the notion of viewing distance (the length of the -vd vector). I could add an option to vwright for the screen distance that would take the view distance and turn on the kind of automatic adjustment you propose. I don't have any way to test it, unfortunately.

Do you think the adjustment of -vh is really necessary? Regardless of what you do with it, the borders will not match for all objects, anyway.

Cheers,
-Greg

···

From: "Lars O. Grobe" <[email protected]>
Date: April 9, 2012 1:45:04 PM PDT

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.

Hi Greg!

My guess is that targeting a 3d-tv format (which is what I did) is rather different then working with slides, where adjustments can be made on display. In my example, especially objects close to the observer were hard to view with standard vwright settings, while the modified vs and vh views led to a rather clear result. I may need to try some more scenes before claiming this to be true in general. To give an idea of the changes for vh, my initial 75 degrees became 72 degrees for a simple test scene, eye distance 0.065m and distance about one meter.

I can dig some more into this, but only after Friday. I wanted to share my work though, so that maybe others can comment or correct me.

Cheers, Lars.

···

--
Dipl.-Ing. Architect Lars O. Grobe

On Apr 10, 2012, at 1:07, "Gregory J. Ward" <[email protected]> wrote:

Hi Lars,

I only ever created stereo slide pairs using vwright, in which case, simply moving the slides closer together a small amount alleviated any discomfort. It amounts to the same as -vs (modulo the image borders).

I wrote vwright before introducing the notion of viewing distance (the length of the -vd vector). I could add an option to vwright for the screen distance that would take the view distance and turn on the kind of automatic adjustment you propose. I don't have any way to test it, unfortunately.

Do you think the adjustment of -vh is really necessary? Regardless of what you do with it, the borders will not match for all objects, anyway.

Cheers,
-Greg

From: "Lars O. Grobe" <[email protected]>
Date: April 9, 2012 1:45:04 PM PDT

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.

_______________________________________________
[email protected]

Lars,

I haven't looked at your code, however, I have looked at the code for VisIt (3D renderer from LLNL) and in vis5d (renderer for weather models) and in both cases they had what I remember to be a simple algorithm for eye location/separation. Both renderers work well in 3D while panning zooming etc.

Doug Reeder

···

On Apr 9, 2012, at 4:56 PM, Lars O. Grobe wrote:

Hi Greg!

My guess is that targeting a 3d-tv format (which is what I did) is rather different then working with slides, where adjustments can be made on display. In my example, especially objects close to the observer were hard to view with standard vwright settings, while the modified vs and vh views led to a rather clear result. I may need to try some more scenes before claiming this to be true in general. To give an idea of the changes for vh, my initial 75 degrees became 72 degrees for a simple test scene, eye distance 0.065m and distance about one meter.

I can dig some more into this, but only after Friday. I wanted to share my work though, so that maybe others can comment or correct me.

Cheers, Lars.
--
Dipl.-Ing. Architect Lars O. Grobe

On Apr 10, 2012, at 1:07, "Gregory J. Ward" <[email protected]> wrote:

Hi Lars,

I only ever created stereo slide pairs using vwright, in which case, simply moving the slides closer together a small amount alleviated any discomfort. It amounts to the same as -vs (modulo the image borders).

I wrote vwright before introducing the notion of viewing distance (the length of the -vd vector). I could add an option to vwright for the screen distance that would take the view distance and turn on the kind of automatic adjustment you propose. I don't have any way to test it, unfortunately.

Do you think the adjustment of -vh is really necessary? Regardless of what you do with it, the borders will not match for all objects, anyway.

Cheers,
-Greg

From: "Lars O. Grobe" <[email protected]>
Date: April 9, 2012 1:45:04 PM PDT

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.