Games like the old half-life use skybox for a sky.Ive also heard about 'skyspheres' The skybox 'follows' the player.So i think it should be not small as the map itself.But rotate with it.Am i right? How about bigger games like Oblivion?Does it use a similar skybox?I mean the map is so big... So,what will you guys suggest?My game is pretty big.Should i use the same skybox?Or a skysphere maybe? Also,how do make flashing stars?Animated sprites? Please post some link about these stuff.

Sol_HSA
—
2008-11-22T21:06:32Z —
#2

Skyboxes, spheres, and whatnot all work with the same basic principle. You have some kind of geometry with the camera fixed at the center. This camera rotates the same way as the "real world" camera does, but it never leaves the center point.

In particular, the sky geometry can also be animated. For instance, in the game I'm working on now we use a cubemap for the basic sky color but also have animated (UV-scrolling) cloud layers alpha bended in front of it.

jirka
—
2008-11-23T06:22:16Z —
#4

Thanks for info. But i wanna know: games like Oblivion,GTA,Just Cause,do they use skyboxes(spheres)?I mean the maps are really big.Dont they eat up computer resources?What i want to know is that might there be another method used in games like these? PS.And about stars.In Oblivion the stars are animated.But what do you think?Are the whole 5 visible cube textures animated(and each might be 512x512).Or there are 'sprites'-separated low res textures?Again,i want to know the best way to save computer horsepower...

Reedbeta
—
2008-11-23T08:03:42Z —
#5

I'm sure the entire texture is not animated to give a few twinkling stars. Like Sol described you can use whatever geometry you want, so it is no problem to throw in a few extra small quads here and there for a few stars and play a twinkling animation.

As for the other games, I don't know what they use, but I suspect the strategy of using a cubemap as a base and then overlaying other stuff (clouds) on top of it is a fairly common one. The clouds can appear much higher resolution because they are relatively small in screen space.

Thanks for info. But i wanna know: games like Oblivion,GTA,Just Cause,do they use skyboxes(spheres)?I mean the maps are really big.Dont they eat up computer resources?

The size of the maps does not have anything to do with the sky geometry size. You can have a map that's a few kilometers in diameter, but still have the sky geometry to fit inside a one-cubic-foot cube.

The trick is in the fact that the camera does not move around in the sky scene, even if it does move in the "real" scene. It does rotate, yes, but is never translated out of the center.

jirka
—
2008-11-23T10:28:15Z —
#7

Ok,im a bit confused... If the skybox is smaller, how come the skybox doesnt collide with the terrain? Could you guys please post a link to a skybox example or something?

Thanks. I think i understand now: 1)the camera should be placed on the center of the skybox,always 2)the skybox should move with the player(camera,but not rotate with it 3)and it should be rendered so its always shown behind all the map objects. Right?

Sol_HSA
—
2008-11-23T15:48:39Z —
#10

Step by step instructions:

Take your camera's transform matrix, and eliminate translation from it.

Render sky geometry with the new matrix

Clear z-buffer

Render your scene normally.

oisyn
—
2008-11-23T22:07:33Z —
#11

You can also reserve a back-portion of the z range for the sky geometry in the viewport settings. That way you don't have to clear the screen. Ideally the sky geometry doesn't need to have much z space in order to keep the reserved range fairly small.

Reedbeta
—
2008-11-23T22:13:35Z —
#12

Or you can disable z-writes entirely while drawing the skybox (if you draw it first), or for front-to-back rendering you can put the skybox at homogeneous infinity and use depth clamping. Of course this assumes you don't need pieces of the skybox to z-test against each other (you sort them back to front yourself or some such).

oisyn
—
2008-11-24T02:31:43Z —
#13

IIRC depth claming was an nvidia-only feature, but I don't know about the current state of hardware.

Sol_HSA
—
2008-11-24T11:19:34Z —
#14

@.oisyn

IIRC depth claming was an nvidia-only feature, but I don't know about the current state of hardware.

glDepthRange is a standard OpenGL feature, but I think this discussion about how to save a tiny bit of performance is really beside the point =)