Space background

Started by
9 comments, last by ArgoN 23 years, 8 months ago
Hi everybody, I''m trying to write a small 3D space-shooter as my first D3D project. Right now it''s very very basic and I''ve met another problem I can''t solve: How do space-shooters display their background graphics? I also want to have a nice star-background in my program The only idea I recently had: The space-background is one big image. When blitting to the screen, I need to choose a rect of it which depends on the orientation (front/up/right vector) of the view matrix, but not on the position. the position is unimportant because the space-background is that "far away" that only the viewer''s orientation but not his position is relevant. My problems: 1) Keeping such a large background as one image would take much memory. Is one big image as a background a common way? 2) Wouldn''t that need different images for different screen resolutions? 3) How do I calculate which part of the image should be blitted to the screen? That would also need a rotation - wouldn''t that be too slow? 4) Or am I completely wrong with my ideas and there''s an easier/faster solution? Thanks for any help, ArgoN
Advertisement
Um, provided I''ve understood you correctly, I may have a suggestion:

Since most of the background in simple space shooters is black, why not create a litle looping particle system for the stars (you could even have multiple layers, with each subsequent layer moving slower and becoming dimmer to give a cool parallax effect), and for things like planets and nebulai (??) just give them an XY location and blit them when they are in sight.
None of this is too hard to do (I did it for my first little project) and works pretty well...

Unless you were refering to something different... in that case, ignore me and hope someone else answers your question
I''ve never done this in practice, but the way it''s done in some games (such as HomeWorld) is to make the background a large sphere, with the game world inside the sphere. You can draw pretty pictures on the inside of the sphere, or you can use the partical system A. Buza mentioned.

Good luck
Steve,
XEOS Digital Development
XEOS Digital Development - Supporting the independant and OpenSource game developers!
That''s exactly what I mean.

Ok, I see that one big image would be waste of memory. So the stars could be rendered randomly and nobody would recognize it. But for nebulas and planets I need fixed positions.

But what if I have many nebulas/planets, like the parsec demo (www.parsec.org). They have nebulas nearly everywhere.

When I use a sphere which surrounds my world, I need to take care that it''s visible everywhere and that the player does not leave the sphere. Wouldn''t it be better to blit the images to the background before rendering the world?

My problem is, that I''m really stuck - I don''t know where/how to begin. *sigh*. The random star background seems to be easy to do. But I need to find a way to blit nebula images which depend on the orientation of the viewport (view-matrix).

ArgoN
the camera is in the middle of the sphere
so the sphere is always at a fixed distance from the camera thus its impossible to leave it have a look at quake there its called a sky box no matter how far u walk in one direction the mountains in the distance never get closer. the only problem with a sphere is the mapping of the coords though this can be fudged with the right texture
and a texture of 512x512x24 bit is only 768kb

Edited by - zedzeek on August 8, 2000 6:38:54 PM
Another idea would be to have a large image with a square/rectangle representing the background for a given view, as the camera pans up, the rectangle moves up the picture, as the camera moves down, the rectangle moves down, so on and so forth. No need to map to a sphere, just remember to wrap the square to the bottom of the picture when it gets too high.
well this is what im thinking say u have a sphere but its made up of a bunch of rectangles

-- think of this rectangle and your in the middle and each
| | side is a bitmap of space now when you rotate the camera
-- grabs what ever bitmap is within the viewing angle and displays it in the back now u would just think of this on a bigger scale with a lot more squares to make up a giant sphere
i dont know it that would be more memory consuming or not
whirlwind u havent tried this have you .
u could always instead of a sphere use a skybox. though it doesnt look as good as a sphere
Ok, I tried a little and finally got some visual results.

I have "background element surfaces" like a nebula and a planet. For each element I store the pitch/yaw angles where this element should appear. While rendering, I calc the view matrix back to euler angles (pitch/yaw/roll) and use the current FOV to determine if and where the background element should appear on screen. So far so good, it seems to work.

Now my problems are:

1) I also have a roll value from my view matrix and my background elements should be rotated accordingly to this angle. I tried to use DDBLT_ROTATIONANGLE for my Blt() calls, but when using this flag, nothing is displayed

2) When trying to Blt() a surface that does not fit onto the screen, it should be clipped accordingly, but Blt() instead simply blits nothing.

3) I''m not sure if my method to display background elements is good/fast. I''d like to check out the sphere method, but:
- I don''t know where/how to start. Can anybody tell me more about sky spheres or point me to some articles/tutorials?
- Wouldn''t that restrict background elements to the size of the max texture size? Wouldn''t that look ugly?

ArgoN
I''ll try it to night. Why take poly''s from the ship models

This topic is closed to new replies.

Advertisement