Jump to content


OpenGL: SkyBox


7 replies to this topic

#1 enigma

    Member

  • Members
  • PipPip
  • 58 posts

Posted 09 October 2007 - 03:19 PM

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.images.../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!!

#2 yakul

    Member

  • Members
  • PipPip
  • 55 posts

Posted 10 October 2007 - 11:07 AM

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.

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 5344 posts
  • LocationSanta Clara, CA

Posted 10 October 2007 - 04:04 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#4 enigma

    Member

  • Members
  • PipPip
  • 58 posts

Posted 12 October 2007 - 08:57 AM

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.images...reenshotho8.png
I've made the texture with GIMP, black background and "SuperNova" filter with radius 1.
- The problem is the texture?
- Other?
Thanks!!!

#5 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 519 posts
  • LocationNowhere whenever

Posted 12 October 2007 - 09:44 AM

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.
http://iki.fi/sol - my schtuphh

#6 enigma

    Member

  • Members
  • PipPip
  • 58 posts

Posted 16 October 2007 - 04:59 PM

Thanks!
In my mind i wanted to obtain a similar effect to this: http://oolite.aegidi.../oolite_002.jpg
Is nice...

#7 Reedbeta

    DevMaster Staff

  • Administrators
  • 5344 posts
  • LocationSanta Clara, CA

Posted 16 October 2007 - 05:11 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#8 z80

    Valued Member

  • Members
  • PipPipPip
  • 104 posts

Posted 16 October 2007 - 06:15 PM

enigma said:

Thanks!
In my mind i wanted to obtain a similar effect to this: http://oolite.aegidi.../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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users