Skybox?skysphere? confused...

A947b6771fc7c5c74da96c5dbd133475
0
jirka 101 Nov 22, 2008 at 17:08

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.

13 Replies

Please log in or register to post a reply.

3c5be51fdeec526e1f232d6b68cc0954
0
Sol_HSA 119 Nov 22, 2008 at 21:06

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.

Thus your “sky geometry” may be anything - box, sphere, actual detailed city scape built from polygons, anything..

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Nov 22, 2008 at 21:36

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.

A947b6771fc7c5c74da96c5dbd133475
0
jirka 101 Nov 23, 2008 at 06:22

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…

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Nov 23, 2008 at 08:03

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.

3c5be51fdeec526e1f232d6b68cc0954
0
Sol_HSA 119 Nov 23, 2008 at 08:34

@jirka

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.

A947b6771fc7c5c74da96c5dbd133475
0
jirka 101 Nov 23, 2008 at 10:28

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?

A947b6771fc7c5c74da96c5dbd133475
0
jirka 101 Nov 23, 2008 at 13:36

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?

3c5be51fdeec526e1f232d6b68cc0954
0
Sol_HSA 119 Nov 23, 2008 at 15:48

Step by step instructions:
1. Take your camera’s transform matrix, and eliminate translation from it.
2. Render sky geometry with the new matrix
3. Clear z-buffer
4. Render your scene normally.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Nov 23, 2008 at 22:07

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.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Nov 23, 2008 at 22:13

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).

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 Nov 24, 2008 at 02:31

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

3c5be51fdeec526e1f232d6b68cc0954
0
Sol_HSA 119 Nov 24, 2008 at 11:19

@.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 =)