OpenGL: SkyBox

83d620dfbcbef079489b68b01351d543
0
enigma 101 Oct 09, 2007 at 15:19

Hi :-)!
I’m working on Elite clone for a school project, with Opengl and Glut.
How can i make a static background with star?
I have thought to use a skybox, but i have some questions.
I have found some images for texture, for example: http://img409.imageshack.us/img409/64/starsbknh1.jpg
- The size of box around the camera.
- The size and the numbers of texture (the same texture for all face or one different texture for every face).
- The box must be transparent (How?).
- How can i obtain an lighting effect of the star?
Too many questions, sorry :-(!
Thanks!!

7 Replies

Please log in or register to post a reply.

E96bdd9352bdf5f0e17646cd08c83b0e
0
yakul 101 Oct 10, 2007 at 11:07

I don’t exactly understand all your questions, but for the skybox size you can make it “infinity”.
Since the position coordinates are homogenous, you can set the w value of the position to 0, which will send it to infinity.
Then after you multiply the position by WVP matrix, you need to set the the z and w coordinates so that z/w will be between 0 and 1.
I never tried this, so I am not sure if it will work exactly this way.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Oct 10, 2007 at 16:04

Yes you can make it infinitely large. Or you can turn off depth writes, draw the skybox, then turn on depth writes and resume, which will ensure the skybox appears behind everything. Then the actual size of the skybox is irrelevant.

I’m not sure what you mean by making it transparent. Surely you don’t want to see “through” the blackness of space to something behind it? :)

As for the textures, for star textures you can probably get away with using the same one for all six cube faces, unless you want there to appear a nebula or galaxy or something like that in the distance.

83d620dfbcbef079489b68b01351d543
0
enigma 101 Oct 12, 2007 at 08:57

Hi! Thanks to all!
I have positioned the camera in (0,0,0), then i have made a box around the camera, the box size is 2x2x2 (i’ve turned off the depth test) . I have applied the texture, the same texture for all face, but the result is not very nice…
Example: http://img353.imageshack.us/img353/8256/screenshotho8.png
I’ve made the texture with GIMP, black background and “SuperNova” filter with radius 1.
- The problem is the texture?
- Other?
Thanks!!!

3c5be51fdeec526e1f232d6b68cc0954
0
Sol_HSA 119 Oct 12, 2007 at 09:44

Making a good-looking space environment is quite difficult by using only a skybox, as the texture resolution is quite limited - even if you use 1k * 1k skybox, the texel resolution is not sufficient when viewed in, say, 1024x768 resolution.. (naturally this depends on the camera settings as well).

So I’d probably do some kind of space cloud thingy with the skybox and would drop in several hundred particles for the stars etc.

83d620dfbcbef079489b68b01351d543
0
enigma 101 Oct 16, 2007 at 16:59

Thanks!
In my mind i wanted to obtain a similar effect to this: http://oolite.aegidian.org/screenshots/images14/oolite_002.jpg
Is nice…

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Oct 16, 2007 at 17:11

Those dark blue cloud things could probably be done nicely with a skybox (wouldn’t have to be too high-res either), while the actual stars would be best done by particles as Sol_HSA mentioned.

254754b37f468a2926bffcd83bbbf1fa
0
z80 101 Oct 16, 2007 at 18:15

@enigma

Thanks!
In my mind i wanted to obtain a similar effect to this: http://oolite.aegidian.org/screenshots/images14/oolite_002.jpg
Is nice…

I would use some real reference pictures instead. Searching for nasa starfield on images.google.com give some pretty good results.