stereographic display and glfrustum

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
ehallein
Posts: 5
Joined: 27.01.2006
With us: 18 years 9 months

stereographic display and glfrustum

Post #1by ehallein » 27.01.2006, 02:10

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

Topic author
ehallein
Posts: 5
Joined: 27.01.2006
With us: 18 years 9 months

problem solved

Post #2by ehallein » 27.01.2006, 04:01

silly me had left and right reversed.

GlobeMaker
Posts: 216
Joined: 30.10.2005
With us: 19 years

Post #3by GlobeMaker » 27.01.2006, 04:32

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
Your wish is my command line.

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #4by Christophe » 27.01.2006, 11:23

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.
Christophe

GlobeMaker
Posts: 216
Joined: 30.10.2005
With us: 19 years

Post #5by GlobeMaker » 27.01.2006, 16:35

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
Your wish is my command line.

Fightspit
Posts: 510
Joined: 15.05.2005
With us: 19 years 6 months

Post #6by Fightspit » 27.01.2006, 19:53

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:
Motherboard: Intel D975XBX2
Processor: Intel Core2 E6700 @ 3Ghz
Ram: Corsair 2 x 1GB DDR2 PC6400
Video Card: Nvidia GeForce 8800 GTX 768MB GDDR3 384 bits PCI-Express 16x
HDD: Western Digital Raptor 150GB 10000 rpm
OS: Windows Vista Business 32 bits

neo albireo
Posts: 68
Joined: 03.02.2005
With us: 19 years 9 months
Location: Switzerland

Post #7by neo albireo » 27.01.2006, 22:55

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


Return to “Development”