• Advertisement
Sign in to follow this  

generating a skybox at runtime

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

Okay so for our space exploration game I need to generate different looking skyboxes for each sector the player can jump to. I think I have the basic idea down, but I'm not sure about the specifics. 1) Build scene...throw stars everywhere, maybe a gaseous cloud or two for good measure. 2) Put the camera in the middle and take 6 "snapshots," i.e. render the scene six times. I'm not entirely sure how to set the view here, just that each shot needs to have 90 degrees FOV up/down and left/right so the skybox's perspective looks right. Which gl commands will I need for this? 3) Put those snapshots into textures...this is where I'm not sure what to do either. Do I need to look up pbuffers? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
For two just position the camera at the center of the scene take one shot pointing in one direction, then rotate 90degrees on the Y-axis (assuming Y is your up/down movement axies), then rotate 90degrees so you are looking up, reset then rotate 90 degrees to look down.

As for three, you can use pbuffers or you can just draw the scene to the back buffer and copy to a texture that way, pbuffers is another alternative if you need a texture rez which could be greater than your display rez.

Hopefully a proper render to texture interface will appear soon (spec is apprently done, just no one outside the ARB has seen it yet) so you will just be able to render directly to a texture as needed.

Share this post


Link to post
Share on other sites
What about for #2, setting up the projection matrix? Do I need to use special values with glFustrum? (never used it) I'm only used to gluPerspective(FOV,(GLfloat)width/(GLfloat)height, near, far); Can I just call that with FOV = 90?

Share this post


Link to post
Share on other sites
yep, you can just use the normal calls, its just like rendering a normal scene, but instead of displaying it you'll be copying it else where.

You might want to check the FOV value you pass in however, I've a feeling it only needs to be half what you want, but i'd check to make sure

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement