Celestia and virtual reality CAVE

The place to discuss creating, porting and modifying Celestia's source code.
Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Re: Celestia and virtual reality CAVE

Post #21by selden » 31.03.2009, 12:47

I'm what's known in some circles as a "computer jock".
I don't write elegant code, I write code that's brute force and straightforward.
I also can only just barely read C++ code.

Superficially, it looks to me like the function getData() is not returning what you expect.
Selden

Topic author
seiryuukami
Posts: 17
Joined: 10.03.2009
With us: 15 years 9 months

Re: Celestia and virtual reality CAVE

Post #22by seiryuukami » 28.04.2009, 09:36

Time for an update!

I've made significant progress, but I have still a few bugs to fix and of course a question or two.
First off, let me say thank you again. I couldn't have gotten this to work even this much without your help. (that goes to a lot of people around here as well) Sorry I got just one screenshot, I'd love to brag some more, but I don't have a Wii controller right now so I can't actually use the program.

vrJuggler sets OpenGL's projection matrix, so I've had to remove almost all the GL_PROJECTION interaction from the Celestia code. There is still interaction with the projection matrix in the rendering of the overlay.

vrJuggler sets its own view frustums and thus its own near and far planes. This is Evil!! Celestia needs to adjust these planes more then once and this has cause many oddities. I have however found a way to set juggler's near and far planes and I'll post it here so that in the unlikely event anyone ever needs to do something like this again then maybe, just maybe, they can find this.

This is the function I use:
(parent is a CelestiaCore*, passed to the Renderer via an argument in its constructor. ( render = new Renderer(this) ) ... )
void Renderer::VRJsetNearFar(float VRJnear, float VRJfar)
{
std::vector<vrj::DisplayPtr> displays = parent->getDrawManager()->getDisplayManager()->getAllDisplays();

for(unsigned int b = 0; b < displays.size(); b++)
{
int ports = displays[b]->getNumViewports();
for(int p = 0; p < ports; p++)
{
vrj::Viewport* bview = displays[b]->getViewport(p);

bview->getLeftProj()->setNearFar(VRJnear,VRJfar);
bview->getRightProj()->setNearFar(VRJnear,VRJfar);
}
}
}

Because the class CelestiaCore inherits vrj::GLApp, it has the getDrawManager function.
The draw manager has a Display Manager.
The display manager has a vector containing all displays.
Each display has a number of viewports.
Each viewport has a right and a left projection.
and Each projection has is own near and far plan.

I chose to go through these for loops each time I need to adjust the values, rather then save the pointers because the loops are very short (4 windows, 2 viewports each) and the configuration of vrJuggler can be adjust while running the program. So to be safe!

I have yet to test this version of Celestia on the actual CAVE, and there are still known bugs with things like labels. The problem of missing textures turned out to be the result of a FAIL vrJuggler configuration.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Re: Celestia and virtual reality CAVE

Post #23by selden » 28.04.2009, 14:31

seiryuukami wrote:I've made significant progress, but I have still a few bugs to fix and of course a question or two.

It's good to know things are progressing well.
I don't see any questions, though.
:-)

(Not that I'm likely to be able to help much!)
Selden

Topic author
seiryuukami
Posts: 17
Joined: 10.03.2009
With us: 15 years 9 months

Re: Celestia and virtual reality CAVE

Post #24by seiryuukami » 29.04.2009, 08:00

Yeah, sorry about that. I kind of got dragged back into working again before I could write down the questions.
So here goes!!

I've been working on a way to replace the mouse pointer (which doesn't show in the CAVE) with something that will work with the Wii. I've made this simple red cross in OpenGL and made it render in Celestia's render Overlay code. The cross can be moved over the screen using very simple, X and Y coordinates. (floats)

The X and Y range from 0,0 (upper left) to 300,-300 (lower right, and the resolution I've been using for developing)
When the user clicks (wii button A) I pass these values on to the CelestiaCore->mouseButtonUp as if it was a normal Left button click. I multiply the Y by -1.0 before calling the function. Like so!

Owner->mouseButtonUp(X,(Y * -1.0),buttons);

Owner->flash(Owner->getSimulation()->getSelection().getName(),10.0f);

Owner is, obviously, a CelestiaCore*. This is part of a class I wrote named WiiSelector.
Unfortunately this goes terribly wrong.
The flash function always shows "#0". No matter what I click on.
I've check the values for width and height within the CelestiaCore, they match the ones of the Renderer. (300,300)
Where could the click-select-object-function-thing go wrong? What else is the function depending on other then the resolution and the X,Y?.. I, failed to grasp things like pick-rays...

Another oddity that scares me is the fact that the ISS is only a few pixels big... even if I'm 5 meters away from it. I thought things like spacecraft are rendered by the same code as other model objects, such as Mars's moons. (yeah, I got a thing for those) But! Phobos and Deimos do appear quite normal, at first. Once I compared the images generated by my CAVE-ish Celestia to the original program, I can't help but noticed that.. everything! is smaller... Earth at 25,513 KM fills the Celestia screen. In the CAVE version, it's not even close. (4,200 KM is more like it)
What could have caused this? I suspect vrJuggler is messing up the aspect ratio and preforming glTranslate of its own with a positive Z value, moving the camera backwards. But! Is there a elegant way to simply scale up things like the ISS a lot, and planets and such a little?

Topic author
seiryuukami
Posts: 17
Joined: 10.03.2009
With us: 15 years 9 months

Re: Celestia and virtual reality CAVE

Post #25by seiryuukami » 29.04.2009, 08:58

And I just found out,
rendering labels and markers has become quite evil!

In the main render loop, the modelview and projection matrices are stored in double[16] variables. Later on these are used to render the labels and markers, correct?

The problem is, the projection matrix is a no-touchy! when working with vrJuggler. I've tried several workaround that I've previously used to combat this problem, but to no avail.

I might try to get permission from my client... or, project commanding person... to disable labels and markers altogether. However, I'm not really the kind of person to worm my way out of a problem in this manner. I can't stand not being able to solve this.
So please!
And brilliant ideas on how to get around this? Show labels and markers like normal but without and projection matrix interaction?

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 3 months
Location: NY, USA

Re: Celestia and virtual reality CAVE

Post #26by selden » 29.04.2009, 19:09

seiryuukami,

I'm sorry I can't really help with your problems. Maybe someone else is sufficiently familiar with Celestia's internals.

The only vague possiblity I've thought of is with regard to objects being drawn smaller than you expected. Is there any possibility that the window viewing angle (that's probably the wrong terminology) is getting set to the wrong value? Celestia's default window angular size is about 30 degrees. I seem to recall that you had to do something special to get it to display the entire 360 degrees in the Cave environment. Drawing an object too small suggests that the view might be too wide. e.g. 360 degrees per wall instead of 90 degrees.
Selden

Topic author
seiryuukami
Posts: 17
Joined: 10.03.2009
With us: 15 years 9 months

Re: Celestia and virtual reality CAVE

Post #27by seiryuukami » 27.05.2009, 11:19

OK, right now there's one problem that really needs to be resolved and I can use all the help I can get.
I found that the Wii Selector class I wrote does work properly, but that in fact the render code is letting me down again.

Because objects are not rendered at the appropriate size, (see previous description of this problem) the selector seems to malfunction. An object appears smaller on the screen that it actually is inside the simulation. I really must get this problem resolved, it makes objects like the ISS practically invisible and the selector useless.

I'd gladly mail my modified render code to anyone for comparison. Maybe you can see where I introduced this mistake?

Topic author
seiryuukami
Posts: 17
Joined: 10.03.2009
With us: 15 years 9 months

Re: Celestia and virtual reality CAVE

Post #28by seiryuukami » 29.06.2009, 07:20

Today is probably the final day of my internship for the virtual reality lab.
I've held my conclusive presentation and demonstration last Thursday.
Let's just say Celesta + CAVE + appropriate music = impress people.
Pretty much everyone who was at the demonstration now thinks I'm awesome. :lol: (even though I made nothing of what impressed them: I didn't make Celestia, nor the CAVE, nor the music. I just put it all together. hehe)
But the good thing is, those people also decide the points I'll get for the internship as a whole.
And since they all seem very pleased with the results of my work, I think I can honestly say: Woohoo!!

I'd like to thank everyone that helped me out. Coworkers at the VRlab, old classmates, teachers.
And of course Selden and Chris! Thanks you guys.

I'd like you to know that even though my official work here is done, there are still some bugs in the program I'd really like to solve. (namely the problem of object scaling.)
I might not get payed to solve this, nor will I receive any kind of virtual-study-point things.
But I just have an affinity for both virtual reality and the celestial.

My e-mail address should be in my forum account information, so should you want to contact me then feel free to.

As a parting gift I've made a few pictures of the CAVE running Celestia.
I must say beforehand though: Because of the stereoscopic projection of the CAVE the images look kind of jittery. Also my camera doesn't really like to capture bright shiny things in a completely dark room.

http://s891.photobucket.com/albums/ac11 ... ecelestia/

john71
Posts: 1009
Joined: 10.08.2016
With us: 8 years 4 months

Post #29by john71 » 17.10.2017, 19:36

By the way, I'm going to buy a VR headset next year. Can I use Celestia with it?


Return to “Development”