Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jda

Stary Background

This topic is 6222 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to figure how to implement a star background in my 3D game. All I need is something similar to game such as X-wing/TIE fighter sort of background. I was thinking about using a cube or sphere and just texture it. Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
a sphere (geo-desic) would be best.

try making multiple ones and mask out the black in the space so you move and the stars are in perspective.

Share this post


Link to post
Share on other sites
Make one vertex for each star. I always set my vertex positions using random numbers. Then, render them as a point list. You could also set some of the vertices to different colors. (Like bright white if you want it to appear closer, or gray for further away.)

You should always render your stars FIRST. Also, before rendering them, turn off the Z-buffer. After rendering them, turn it back on. That way, everything you draw afterword will draw in front of them, making the stars appear to be an infinite distance away.

One note when using the random numbers, if you leave them all positive, you will get stars only in one small area. Think of the world as 8 areas.
(x, y, z) (-x, y, z) (x, -y, z) (x, y, -z)
(-x, -y, z) (-x, y, -z) (x, -y, -z) (-x, -y, -z)

So make sure you get all these combinations with your numbers. I have used this several times and I think it looks MUCH better than any textured object. This, of course, really only works for space games.

Hope it helps! =)

Share this post


Link to post
Share on other sites
I''m trying to solve the same problem,and I am currently struggling with the textured sphere approach. The downside to this is getting all the texture coordinates right so that everything appears "sharp" I have a lot of texture smearing at this point, but I think I can get things working.
The Pointlist approach was my original idea, but it has the downside that every star is going to be the exact same size, but that should not be a problem as long as the colors vary enough.
I am envisioning that my final solution will consist of both a textured sphere and a pointlist.

-andy

Share this post


Link to post
Share on other sites
Heya,

If you wont move too much (your playground is not too big), you could also make a skybox and paint stars and planets on it!

Share this post


Link to post
Share on other sites
I''ve been working on the same problem. I was thinking about random vertices and a pointlist, but the problem I see with using just random xyz coords is that the stars will be randomly generated within a cube, but from the camera''s perspective the distribution won''t be uniform (if you don''t understand why... well, sorry, I find it hard to explain). You''d be better off picking random 3d vectors and translating some distance along them. Does anyone know a good way to pick random 3d unit vectors? I remember this being a long topic of discussion on a message board somewhere, may have been here.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!