Page 1 of 1

stereographic display and glfrustum

Posted: 27.01.2006, 02:10
by ehallein
I am trying to modify celestia to allow proper stereographic viewing (we are a University astronomy group http://vr.swin.edu.au). The first thing I need to do is convert all calls to gluperspective to glfrustum. This is needed to have non symetric frustums for the left and right eyes. However this seems to be harder than I expect.

As a simple test I have changed the first call to gluperspective in renderer::render() in render.cpp to a glfrustum as follows

//work out the scaling between the screen and the near camera clip, as we compute frustum positon from screen size
GLdouble resRatio = (float) windowWidth / (float) windowHeight;

GLdouble rfov = degToRad(fov/2.0);//radians
GLdouble screenH = NEAR_DIST*tan(rfov);
GLdouble t = screenH; //top
GLdouble b = -t; //bottom is -top
GLdouble l = t * resRatio; //left is the ratio of width/height*top
GLdouble r = -l; //right is -left


// Set up the projection we'll use for rendering stars.
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(stereo)
{
glFrustum(l,r,b,t,NEAR_DIST,FAR_DIST);
}
else
{
gluPerspective(fov,
(float) windowWidth / (float) windowHeight,
NEAR_DIST, FAR_DIST);
}

this is all that is changed. My understanding is that these two calls are essentially the same.

However whenever when I call glfrustum instead of gluperspective the stars are no longer drawn as disks or fuzzy points. Only points will work. If I change all of the gluperspective calls things get worse, such as planet faces being rendered inverted.

Is there any inherent reason why celestia needs to use gluperspective? Is it a gl bug? I am us osx 10.4.4.

Thanks in advance

problem solved

Posted: 27.01.2006, 04:01
by ehallein
silly me had left and right reversed.

Posted: 27.01.2006, 04:32
by GlobeMaker
What equipment is needed to look at your stereo display?

Can I split my CRT screen in left and right halves and look at it with two
tilted mirrors? It seems like that would work as an inexpensive way to
merge two halves of a CRT into the distance between my two eyes.
Projective geometry could be used by the program to correct for the
mirrored inversion and the perspective distortion.

In other words, two mirrors can be laid on the desk in front of the
CRT screen. They are tilted to form a V shape, adjusted to combine
the left and right images to hit my eyes at the right width.
Hardware cost : four space dollars.
Software cost : free.
Image
You can see a bigger version of this diagram at :
http://www.reliefglobe.com/3d_002.jpg

Posted: 27.01.2006, 11:23
by Christophe
No need for this complex mirror setup. You can experience stereoscopic vision with Celestia very easily by using cross viewing.

Split the screen vertically, then rotate the right view to the left slightly (the right observer should now be at the left of the left observer). Now cross your eyes until both images merge. This requires some practice and is a bit tireing. Celestia lacks a mean to control both views simultaneously so you can't "move arround", but it's a cheap and effective way to do stereo.

Posted: 27.01.2006, 16:35
by GlobeMaker
Hello Christophe, I tried your suggestion and it works. I do not cross my
eyes, I relax them to the positions they go to for looking far away. The two
images were combined pleasantly to perceive the depth of the stars over
12,000 light years. Then I looked at the planets in motion as they circled
the Sun with depth perception. Thank you, I enjoyed that.

Please consider the advantages and disadvantages of the two methods.

Your method limits the width of the over-lap area to about 7 cm. That is
the distance between my eyes. If the two images are separated more than
7 cm, the two pictures cannot be combined with relaxed eye directions.
(I do not cross eyes, I do not recommend that). The advantage of your method
is immediate good results. Your method is free. The pictures can be reduced
in size on the screen to be so small that they are 7 cm wide, so the full
picture has overlap. At 1024 by 768 screen resolution for my 30 cm
wide monitor, the number of pixels is only 1024 * 7cm/30cm = 238 pixels
wide and 768 pixels tall. The monitor can stay in its usual position.

My method can produce full-screen overlap for any size monitor. By using
mirrors that are 7 cm wide, and positioning them close to the eyes, the
whole monitor can be reflected into the eyes. The disadvantage is that
the apparatus is not free and it needs more precise alignment. To remove
the distortion due to perspective, the monitor would need to be rotated
downwards to face the mirrors. An additional advantage is that, the
mirrors can be rotated to face two different monitors, so the full
1024 by 768 is seen with both eyes. A picture of this dual monitor
apparatus can be seen in the following link. The positions and
rotations of the monitors and mirrors needs to be precise. But once it
is all set up, the results are imagined to be wonderful :
http://www.reliefglobe.com/3d_003.jpg

Posted: 27.01.2006, 19:53
by Fightspit
If you want, you can buy a "3D" flat panel. 8O

See here for more information:
http://www.sharp3d.com/products

I think it is more simple but it is more expensive (> 1000$)! :lol:

Posted: 27.01.2006, 22:55
by neo albireo
Christophe,
I tried your method too and I got addicted :D. I especially liked:
    - the view on Saturn and its inner moons (rings vertically to make use of the abundant vertical space)
    - the view some lightyears away from the sun, in synch orbit mode around our sun with accelerated time speed and with constellations on, so you get the most 3d-feeling from the constellation-"cristals"
    - the eclipses on jupiter
    - the view on our galaxy, again circling in synch orbit around our sun