Background in space - how?
Hello,
in my space kind-of-space-simulation-game I want some ships flying through the space (who would have thought?). Now I am thinking about the way how to implement the background.
The easiest way (for me) is to load a spere model with the radius a litte smaller than the maximum looking-range, but I found out that this way is rather performance slowing...
...do you know other ways to show a background image?
Thanks in advance,
Marco
Same thing with a moderatly large cube!
here is a hint to make it look quite awesome... I found this ou from my space game attempts: Try to anchor the center of the cube to the center of the camera. that way, the cube can not only be as big as you want, but as the camera moves around, the cube does too, so that it LOOKS like the stuff on the cube is infinitly far away. Just like the fact that in real life the moon seems to follow you and looks far away, except this time the moon would ACTUALLY be following you!
here is a hint to make it look quite awesome... I found this ou from my space game attempts: Try to anchor the center of the cube to the center of the camera. that way, the cube can not only be as big as you want, but as the camera moves around, the cube does too, so that it LOOKS like the stuff on the cube is infinitly far away. Just like the fact that in real life the moon seems to follow you and looks far away, except this time the moon would ACTUALLY be following you!
Rather than use a sphere, most games would use a sort of "Sky box". This is often a cube, or sometimes an octahedron - certainly requires less geometry than even a course sphere.
Of course the "sky box" should be rendered such that it does not become closer or further from the camera ever, this is typically achieved by drawing it before camera translation is performed (or just changing the view matrix or something).
Remember that you don't need to render the entire scene using the same camera parameters (even if that seems counter-intuitive)
There should be no problem with maximum view planes / z buffering, as you will want to render the skybox with z buffering disabled. As such, it doesn't matter even if it is "nearer" (in coordinate terms) than your objects, it will still appear behind them.
Normally I'd suggest rendering the sky box first before anything else. Note also that because the sky box takes up the whole sky (by definition, really), you won't need to clear the accumulation buffer before you start drawing.
Mark
Of course the "sky box" should be rendered such that it does not become closer or further from the camera ever, this is typically achieved by drawing it before camera translation is performed (or just changing the view matrix or something).
Remember that you don't need to render the entire scene using the same camera parameters (even if that seems counter-intuitive)
There should be no problem with maximum view planes / z buffering, as you will want to render the skybox with z buffering disabled. As such, it doesn't matter even if it is "nearer" (in coordinate terms) than your objects, it will still appear behind them.
Normally I'd suggest rendering the sky box first before anything else. Note also that because the sky box takes up the whole sky (by definition, really), you won't need to clear the accumulation buffer before you start drawing.
Mark
Thanks for your answers. I have done it with a box now, so there are some fps more. Then I changed my model-class to draw the model into a list and then render the list, so I got more fps again. And I have done the thing with the z-Buffering, so there is no need to scale the model and so on... thanks!
But overall there is a siginificant loss of fps. Before I implemented the skybox I had around 1200 fps, but now I have around 900. Okay, 900 fps are very fast, but my machine is not the worst, so I am afraid of others with weaker machines having trouble with the fps. I'll check that.
Did you also get such a big fps loss?
Marco
But overall there is a siginificant loss of fps. Before I implemented the skybox I had around 1200 fps, but now I have around 900. Okay, 900 fps are very fast, but my machine is not the worst, so I am afraid of others with weaker machines having trouble with the fps. I'll check that.
Did you also get such a big fps loss?
Marco
im also making a space sim but have no luck getting/implementing the background/atmosphere of space that i want. anyone ever played freelancer? the atmosphere of space in that game made my jaw drop that how i want space to look in my game but not at all sure how to go about it.
ps. sorry for invading your post Marco H but it seemed the best place for my post
ps. sorry for invading your post Marco H but it seemed the best place for my post
Blaaaaa Blaaaa Blaa errrrr!!!! Bla?
Allthough a sky box with a resnoably hig resolution will work well.
The best thing for a space sim might be a skybox/paticle system
combo.
A fps of 900 is still good, if you calcylate the actual extra time it takes to render the skybox, it's not that significant.
Lets say that you are running it at 150fps without skybox, then it would still be 150fps with the skybox.
You should aim for a fps that is around 60-90.
The best thing for a space sim might be a skybox/paticle system
combo.
A fps of 900 is still good, if you calcylate the actual extra time it takes to render the skybox, it's not that significant.
Lets say that you are running it at 150fps without skybox, then it would still be 150fps with the skybox.
You should aim for a fps that is around 60-90.
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
I also found out this day, that there are two solutions:
Either you take a sphere as sky, then you can map complex pictures on it, but they must have great dimensions to achieve proper quality.
Or you make a skybox. But then you can only map a simple texture, for example only stars, at it. No suns, nebulas etc., beacuse it would be mapped on every of the 6 inner surfaces of the box.
I think I'll take the second option, as the time to load the high resolution pictures is too high for me (I want the game fast-starting).
@SKREAMZ:
I have never player Freelancer, but perhaps you could describe the athmosphere?
Either you take a sphere as sky, then you can map complex pictures on it, but they must have great dimensions to achieve proper quality.
Or you make a skybox. But then you can only map a simple texture, for example only stars, at it. No suns, nebulas etc., beacuse it would be mapped on every of the 6 inner surfaces of the box.
I think I'll take the second option, as the time to load the high resolution pictures is too high for me (I want the game fast-starting).
@SKREAMZ:
I have never player Freelancer, but perhaps you could describe the athmosphere?
You should be able to do what you want with the sky box provided you get the textures on the 6 sides of the cube right.
One reason I suggested using an octahedron is it's perhaps easier to get the textures right?
In either case, you'll need more than one texture. Try to figure out what the mapping should be to get things spot on.
If you use an octahedron you could potentially use two textures for the "top" and "bottom", split it into two square-based pyramids stuck end-to-end.
Or for a cube, six distinct textures. Maybe rendering them individually with a raytracer would be helpful.
If done correctly, you won't see the joins.
For individual objects you might want to draw them as billboards or something though in the background (bright stars etc)
Mark
One reason I suggested using an octahedron is it's perhaps easier to get the textures right?
In either case, you'll need more than one texture. Try to figure out what the mapping should be to get things spot on.
If you use an octahedron you could potentially use two textures for the "top" and "bottom", split it into two square-based pyramids stuck end-to-end.
Or for a cube, six distinct textures. Maybe rendering them individually with a raytracer would be helpful.
If done correctly, you won't see the joins.
For individual objects you might want to draw them as billboards or something though in the background (bright stars etc)
Mark
A skybox is prefered over the octahedron though.
Mostly because it's easier to generate than the octahedron(i have actuarly never seen anyone use a octahedron before, hemispheremapping is more common).
And allso to reduce resolution problems at the edges of the cube/octahedron.
Distant large planet's that you are not going to come anymore closer(rellatively speaking) to and bright stars should be billboarded.
Asteroids, close planets and it's moons should be geometry.
Allso note that when you have rederd the background you don't need that z data anymore, witch means that you can render the planets, moons and asteroids at a totaly different scale and then clear the z buffer.
Mostly because it's easier to generate than the octahedron(i have actuarly never seen anyone use a octahedron before, hemispheremapping is more common).
And allso to reduce resolution problems at the edges of the cube/octahedron.
Distant large planet's that you are not going to come anymore closer(rellatively speaking) to and bright stars should be billboarded.
Asteroids, close planets and it's moons should be geometry.
Allso note that when you have rederd the background you don't need that z data anymore, witch means that you can render the planets, moons and asteroids at a totaly different scale and then clear the z buffer.
www.flashbang.se | www.thegeekstate.com | nehe.gamedev.net | glAux fix for lesson 6 | [twitter]thegeekstate[/twitter]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement