Jump to content


Skybox?skysphere? confused...


13 replies to this topic

#1 jirka

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 22 November 2008 - 05:08 PM

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.

#2 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 510 posts
  • LocationNowhere whenever

Posted 22 November 2008 - 09:06 PM

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

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 22 November 2008 - 09:36 PM

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

#4 jirka

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 23 November 2008 - 06:22 AM

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

#5 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 23 November 2008 - 08:03 AM

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

#6 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 510 posts
  • LocationNowhere whenever

Posted 23 November 2008 - 08:34 AM

jirka said:

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

#7 jirka

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 23 November 2008 - 10:28 AM

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?

#8 martinsm

    Member

  • Members
  • PipPip
  • 88 posts

Posted 23 November 2008 - 12:13 PM

Read here: http://www.devmaster...#postcount51905

#9 jirka

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 23 November 2008 - 01:36 PM

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?

#10 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 510 posts
  • LocationNowhere whenever

Posted 23 November 2008 - 03:48 PM

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

#11 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 23 November 2008 - 10:07 PM

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.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#12 Reedbeta

    DevMaster Staff

  • Administrators
  • 5308 posts
  • LocationSanta Clara, CA

Posted 23 November 2008 - 10:13 PM

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

#13 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 24 November 2008 - 02:31 AM

IIRC depth claming was an nvidia-only feature, but I don't know about the current state of hardware.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#14 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 510 posts
  • LocationNowhere whenever

Posted 24 November 2008 - 11:19 AM

.oisyn said:

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users