PDA

View Full Version : moving skybox?



candy
01-13-2004, 05:19 AM
Hi all, I am quite curious abt the creation of a moving skybox. Though I have do a search and have a look for the post abt skybox posted in this forum before, I still can't get what I want (or I am too stupid and can't find the thing out..)

What I would like to do is to create a skybox so that the user who are on the terrain will be "visually" never be able to reach the terrain margin (so that the terrain seem to be infinitely large..)

Sorry for my poor English, I hope that you could get what I mean and teach me how to do so... thx a lot

zeckensack
01-13-2004, 05:29 AM
When you render 'usual' scene objects, you simulate camera movement by translation and rotation. For the skybox, you should use the same rotation, but no translation. That's all there's to it http://www.opengl.org/discussion_boards/ubb/smile.gif

candy
01-14-2004, 03:13 AM
Sorry for my stupidity. After I do the adjustment as advised, I can really never be able to reach the sky. However, I have something that do not understand. Even in this situation, the user is actually moving on the terrain, when I instruct the "player" in the game to walk forward, the effect of the code is that the terrain seem moving backwards. And after some time, the "terrain" is even "after" the "player" and so the player just see the "skybox" in front of him...

Is that I do sth wrong?

JoCCo
01-14-2004, 04:48 AM
Candy, you probably walked to the end of the terrain and therefor it looks like it's behind you, the skybox is moved when you move so you can't use it as a point of reference to were in the world you are...

candy
01-14-2004, 05:30 AM
Originally posted by JoCCo:
Candy, you probably walked to the end of the terrain and therefor it looks like it's behind you, the skybox is moved when you move so you can't use it as a point of reference to were in the world you are...


Dear JoCCo, Sorry ar..I can just understand half of your meaning (but it is certainly my problem) I agree your point in the 1st first ..but I don't understand what means by a "point of reference to were in the world you are.. "

Would you mind explaining me more abt that?

Azazel
01-15-2004, 12:52 AM
Shalom! I dont know what is the problem. Skybox is moving together with player, did you knew that? About terrain - are you still using 2D cycles http://www.opengl.org/discussion_boards/ubb/smile.gif like

for(i=0;i<N;i++)
for(j=0;i<M;j++)
{
...
}
???

You should describe every object by properties, put all that in database and display ony that objects that are near to player. Also every object must have a sector property - the way to divide large levels. Sector is some area and object bundle that are visible being in that sector. All sectors that have no other sectors around should have empty terrain in a visible range. You should determine in what sector player is. If there is no sector - player is out of mission area and you should display some pattern terrain around him.


Cool I had teached you, huh? http://www.opengl.org/discussion_boards/ubb/smile.gif Yes, I am a teacher. I teach guess what. My name is AZAZEL - he teached too.

candy
01-15-2004, 01:06 AM
ya, i am still using the 2 for-loop..

would you mind giving me a link to teach me the way for the rendering as what you mention?

Azazel
01-16-2004, 12:37 AM
There is a lot links! Go to the gamedev.com and search! Also, before making game in 3D you should have a pracice making some game consoles in 2D. Try to write Commando game terrain in Delphi or C++ Buider as I wrote, imitating doublebuffer by TBitmap.

candy
01-16-2004, 06:34 AM
But I really don't have so much time in writing the simple program.....

candy
01-16-2004, 06:52 AM
Actually, if I use 2 for loop to render the terrain, it will affect the moving skybox and cause the problem as I encountered now?

Azazel
01-19-2004, 10:46 PM
SkyBox must be rendered first, and without putting pixels in depth buffer. It is done by setting glDepthMask(FALSE);

zeckensack
01-20-2004, 05:14 AM
Originally posted by candy:
Sorry for my stupidity. After I do the adjustment as advised, I can really never be able to reach the sky. However, I have something that do not understand. Even in this situation, the user is actually moving on the terrain, when I instruct the "player" in the game to walk forward, the effect of the code is that the terrain seem moving backwards. And after some time, the "terrain" is even "after" the "player" and so the player just see the "skybox" in front of him...

Is that I do sth wrong?

If your terrain ends, you need to render a larger terrain http://www.opengl.org/discussion_boards/ubb/wink.gif
The skybox, as described, is infinitely far away. You'll never be able to reach it, and that's what I thought you wanted.
But it's not a replacement for larger terrain. It's just a nice backdrop that gives the impression of correct sky. No more, no less.

There are two basic choices for your "ending terrain" problem:
1)Constrain player movement to be always inside a region, so that he/she will never notice that there is an "end of the world". This works for both semi-indoor worlds (eg Quake 3, try "/devmap q3dm1"; or UT2k3, fly around "Antalus" in spectator mode, you'll see), and for outdoor environments, if they're surrounded by inescapable fences/walls/mountains etc.

2)Go infinite outdoor terrain. Morrowind is a real good example. The outer regions are just empty water (with random water creatures), and the player will eventually drown anyway if he goes to far away from the island. So they don't need any fences or other artificial limits to the world, they can just generate any number of these empty water cells as required.

Or maybe I completely misunderstood, and what you were saying was indeed a problem with the skybox cutting off parts of your terrain.