Starry background

Started by
6 comments, last by DangerDave 20 years, 8 months ago
How would I go about putting a background of stars in a 3d space sim? Would I need to have a huge spherical mesh encompassing what the user sees and then texture it with a starfield? That seems a bit heavy for a simple background texture effect... Any ideas? Dave.
Dave.
Advertisement
If it''s just a background, why not use a skybox?

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"
why not a skybox indeed... whats a skybox? Any links or more info would be great, cheers.

Dave.
Dave.
A skybox is juat a big box around your world. Then you add textures to each side of the box.

Heres a nice tutorial/demo/source for skyboxs. Good luck Dave.

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"
or just do a simple pixel (or particle/sprite) starfield that you draw behind all your 3d objects. therefore you don''t have to worry about skyboxes or (in your case) big large spheres.
I eat heart attacks
The problem with using a skybox for a starfield is that the textures have to be huge in order to provide the fine detail that you want. The smallest a star could be is one texel and ideally you''d want that texel to project to one screen pixel or pretty close to it. So at a screen res of 1280x1024 you''d need 2048x2048 textures and a horizontal FOV of about 57 degrees to achieve this. Make that a 1024x1024 texture and the texel is obviously going to project to around four pixels. If you went up to 1600x1200 then even 2048x2048 isn''t ideally big enough but it might still look okay.

You could use texture wrapping to get by with smaller textures but that precludes painting larger features into the skybox like nebulae and galaxies. And it''s still a lot of fill-rate for drawing mostly black pixels.

I would suggest point sprites as one alternative. On Freelancer we actually drew line primitives when the camera was rotating to get a motion blur effect.
Donavon KeithleyNo, Inky Death Vole!
I''d just scatter a few particles in the background (make sure they''re done so that all other objects'' z value will over write them).

A skybox is simply a box with all the faces facing inward, drawn so that the camera is always in the center of it (i.e. it uses a world matrix equivilent to the camera''s location), and rendered so that all z values over write it.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

Bit of a late thankyou but here it is nevertheless. Thanks guys, that should help a lot.
(P.S. Freelancer kicks ass!)

Dave.
Dave.

This topic is closed to new replies.

Advertisement