Jump to content
  • Advertisement

Archived

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

UnknownPlayer

Sky boxes

This topic is 5740 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

What''s the best way to go about implementing sky boxes? Particularly in relation to a 3D space sim (what I''m writing) where ideally it''s impossible for the player to ever get past the sky box but it still seems as though its a textured sphere surrounding them (i.e. when they rotate around the stars and nebulas move appropriately). Any help would be really appreciated. ##UnknownPlayer##

Share this post


Link to post
Share on other sites
Advertisement
You just need to draw a cube centered in the camera, so when the camera moves, it won''t reach the cube''s sides. You don''t need to rotate it (the cube remains still).

For rendering the cube, IMO the best choice is to draw it before any other geometry, without depth writing/reading. The size of the cube doesn''t matter, just keep sure the vertices are inside the frustum.

Share this post


Link to post
Share on other sites
Turn off depth writing, rotate based on camera orientation, ( so transform to the cameras frame, but make sure it doesn''t include translation attributes, as this would enable you to fly out of the skybox ) and render the box. So:

1. Disable depth writing
2. Push and multiply modelview matrix by the camera frame ( excluding translation )
3. Render cube
4. Pop modelview matrix
5. Enable depth writing

Death of one is a tragedy, death of a million is just a statistic.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!