PDA

View Full Version : Outer space skybox textures



starman
10-08-2003, 05:13 PM
I'm working on an outer space simulation and just implemented a skybox starfield background. Unfortunately, because of the size needed for the box, the stars are fuzzy and distorted.

What's the best way to implement something like this? Should I use a smaller box and move it with the camera?

gumby
10-08-2003, 05:33 PM
The skybox should always move with the camera. If most of your skybox is black, you may be able to use a number of high-res billboards for better effect...

10-08-2003, 08:09 PM
Yes, use a "small" skybox and keep it centered on the "camera" position. You can probably do a depth testing trick to make it look like the skybox is truly "huge" (even though it may not necessarily be so), but still be able to see the detail on the skybox faces.

PanzerSchreck
10-09-2003, 12:56 AM
I think the best way for a game that's situated in outerspace is to not include any stars in your skybox,but instead render them by yourself using for example GL_POINTS.That has two advantages : First your stars won't get stretched and second is that you can move them around like you want to give the player a feeling of motion.

10-09-2003, 01:06 AM
actually, I worked on a similar problem for my engine (also outer space simulation), and there's a simple workaround:

To render the skybox:
// assuming modelview matrix as current
glPushMatrix();
float m[4][4];
glGetFloatv(GL_MODELVIEW_MATRIX, m[0]);
m[3][0] = 0; m[3][1] = 0; m[3][2] = 0;
glLoadMatrixf(m[0]);
glDisable(GL_DEPTH_TEST);
glDepthMask(0);
---> Render Sky Box
glDepthMask(1);
glEnable(GL_DEPTH_TEST);
glPopMatrix();

NOTE: Skybox must be the first thing rendered in your engine! And just use a simple box with extensions (-1,-1,-1)-(1,1,1)

Optimization: Don't use a box but use a coarse sphere - simply looks a lot better

MFG OmegaSquad

starman
10-09-2003, 04:02 AM
Thanks for all of the replies. I wonder if I could combine a couple of approaches suggested here: plot points with GL_POINTS, but in a spherical pattern around the camera instead of a box?

Sounds like there are a lot of options. Thanks again.

10-09-2003, 07:21 AM
Use a shpere instead, much more good looking me thinks..

starman
10-09-2003, 07:39 AM
I did some googling on the topic and the overwhelming majority favor using a box. Simple, low poly count, and most of the games get great results with it.

My biggest problem was that I was not moving the box with the camera. I'll fix that tonight.

poo
10-09-2003, 07:39 AM
I'm still quite new at this, so forgive me if this isn't the best option. Why not have a single texture of your star field and create a background image in orthographic perspective before drawing the rest of the scene. Then you could could just pan the texture acrossed the poly as rotation changes. I mean, if your stars are just dots, then you'll never be able move close enough to them to change the relative distance between the stars and you, or other stars. This way you only use a sigle poly and you wont get any distortion of your texture.

[This message has been edited by poo (edited 10-09-2003).]

starman
10-09-2003, 11:02 AM
I tried what OmegaSquad advised. Found similar advice on the Web, along with skymap textures for starfields.

The map appears and moves with the camera and doesn't rotate (good), but still the textures look huge, faded, and pixelated. Even with small skyboxes (10x10x10).

Any ideas?

starman
10-09-2003, 12:42 PM
Figured it out! A couple of problems:

First of all, I was not disabling lighting when drawing the skybox. Doing that fixed the problem of the dark, faded textures.

Second of all, my FOV was not 90 when drawing the skybox. Setting it to 90 put the textures in their proper perspective and they didn't look pixelated anymore. I just push/pop the projection matrix to get back to my normal scene FOV.

10-10-2003, 04:14 AM
Look into homeworld's space scene, It's great
and the source code is avaialable http://www.opengl.org/discussion_boards/ubb/smile.gif
JitzuIbixZum sez good bye