Sign in to follow this  
cebugdev

implementing skybox in a chunked scene/level

Recommended Posts

cebugdev    635
Hi all,

I have implemented my scene/level using chunked style, arranged as a grid depending on the current location/position of the character.
The chunks LOD varies dpdending on the distance of the chunks from the current chunks. There is also a fog that "hides" those chunks with low LOD. Using this approach I can implement large scene such as a large city similar to popular games. This approach was already implemented and working OK. I think this approach is being used by most commercial games.

However, I need help on the following
1. I am confused on how to display the sky. Since this is a large scene/level displayed as chunks, How can i display the sky then?
Do I need to create a very large skybox to enclosed my scene?

I am also thinking of including a portion of the skybox on each chunk, giving each chunk the ground model and the sky, and the chunk
that represents the edge of the world will also has the "wall".

My question is how is this done by commercial games?

Hope somebody can give advise on what is the best approach to this.
Sory for poor grammar, please ask if the above were not understood,

Thanks in advance.

Share this post


Link to post
Share on other sites
Triad_prague    161
Hello, IMO you don't need to display a *HUGE* skybox just to show the sky. I only draw a 10 unit size cube with proper texture on it. The cube is drawn first, the faces are facing inside, and I disable depth testing and depth writes when drawing it. Then I turn depth testing and depth writes back on and draw other objects in the scene. It creates illusion of *LARGE* box encompassing all objects in the scene.

Share this post


Link to post
Share on other sites
mhagain    13430
You can also draw your skybox as a 10x10x10 cube after the scene by setting your minz and maxz both to 1 in glDepthRange or a D3D viewport. What's really nice about this method (whether you use before or after) is that you don't need to worry about adjusting your far clipping plane to enclose the skybox bounds.

Share this post


Link to post
Share on other sites
cebugdev    635
[quote name='Triad_prague' timestamp='1326371415' post='4901974']
Hello, IMO you don't need to display a *HUGE* skybox just to show the sky. I only draw a 10 unit size cube with proper texture on it. The cube is drawn first, the faces are facing inside, and I disable depth testing and depth writes when drawing it. Then I turn depth testing and depth writes back on and draw other objects in the scene. It creates illusion of *LARGE* box encompassing all objects in the scene.
[/quote]

If i a have a 10 unit size cube with texture and render it with the depth testing disable,
what would be the coordinates(transform) of this cube when rendered,

will it always be centered on the player's position as what [url="http://www.gamedev.net/user/182614-turch/"][color=#284b72]turch[/color][/url] have suggested, or will it only stays on one place (0,0,0)?

Share this post


Link to post
Share on other sites
doeme    1189
[quote name='cebugdev' timestamp='1326695287' post='4903146']
If i a have a 10 unit size cube with texture and render it with the depth testing disable,
what would be the coordinates(transform) of this cube when rendered,

will it always be centered on the player's position as what [url="http://www.gamedev.net/user/182614-turch/"][color=#284b72]turch[/color][/url] have suggested, or will it only stays on one place (0,0,0)?
[/quote]

Center it around your camera (which often is 0,0,0) and transform it with the inverse of the camera rotation. With the technique described above the box can even be smaller than 10 by 10, just be sure that it fits into your frustrum. Also if you play on a fairly level terrain with no holes in it you might want to omitt the lower part of the skybox/skysphere because it will never be visible.

[quote name='cebugdev' timestamp='1326366022' post='4901961']
I am also thinking of including a portion of the skybox on each chunk, giving each chunk the ground model and the sky, and the chunk
that represents the edge of the world will also has the "wall".
[/quote]
Do you want to do this to mask the seam between the skybox and the terrain? For this the easiest solution might be to use fog in the color of the seam to mask this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this