views:

42

answers:

3

What are some advantages and disadvantages between the two. Especially for something like a 3D game.

+2  A: 

It is easier to make textures for skybox. Also polygon count will be smaller (but this is negligible with today cards).

The only problem with skybox is that the edges of the cube may be visible under certain conditions.

Another aspect that makes a difference:

  • skybox will never collide with the geometry - the image is only projected from another camera that rotates together with the user camera and is "stuck in the box"
  • in case of skysphere, the background will render directly (player can "bump into the sky")

A good description and OpenGL sample is here.

Marek
The player shouldn't be able to bump into the sky. It's meant to stay still relative to the player!
Martin
+3  A: 

Skyboxes and skyspheres are pretty much equivalent in the sense that you will get the same kind of visual effect - i.e. a nice background that appears to be at a long distance away.

However I'd normally recommend a skybox for the following three reasons:

  • Less polygons required
  • Assuming you set up your projection matrices correctly, you can't tell that you are inside a box (if you get it wrong, you may see some distortions)
  • It's easier to render square skybox images (one for each of the size directions)

Regarding the last point, it is pretty easy to configure a renderer to produce raytraced square images that exactly fit on a skybox by creating a 90 degree field of view, e.g. in POVRay you would use something like the following:

camera {
   right -x
   up y
   direction -z
   location 0
}

I typically use 1024*1024 or 2048*2048 square textures for this.

The one good reason I can think of to use a skysphere is if you are using some kind of procedural texture approach that requires generation at (approximately) the points on a unit sphere. I think that is a pretty special case however, and unlikely to be necessary for most gaming applications.

mikera
The point about polygons is untrue - with shaders either method requires a single triangle as a minimum...
jheriko
Interresting answer but it don't say if SkySphere have any advantage over SkyBox? Is there some cases where it's simply better? Maybe when you allow any rotation?
Klaim
A: 

Another advantage of skyboxes is being able to use a cubemaps for them - sphere mapping on the other hand is not hardware accelerated (afaik).

jheriko