Jump to content
  • Advertisement
Sign in to follow this  
baddogj

making a skybox?

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

does anyone know of tutorial that teaches how to make a skybox in your game that doesn't require any programs. i searched all around google and couldn't find anything. thanks in advance. [Edited by - baddogj on October 24, 2004 9:30:05 AM]

Share this post


Link to post
Share on other sites
Advertisement
Try gametutorials.com, they have a skybox example in the DX section. Later on you may want to speed up your skybox rendering using cubemaps ..

good luck

Share this post


Link to post
Share on other sites
Quote:
Original post by Mille
Later on you may want to speed up your skybox rendering using cubemaps ..


erm... how so? not that something like an old-fashioned skybox would need much of a speed boost anyway, but the only advantage of using a cubemap comes into play if you also want to use it for cubemapping on objects. else its just a fancy but useless thing to do. except you want to say that clipping a few unused quads and sending one quad instead of 2 strips or 6 quads is making any difference when looking at the fillrate its eating one way or another.

Share this post


Link to post
Share on other sites
Is there something more to making a skybox then simply texturing a big box then centering it on your scene? Because thats what I do but I see so many questions about them it sounds like its harder then just that.

Share this post


Link to post
Share on other sites
I found the tutorial slightly helpful. It suggests making a huge cube centered on the camera. It dawned on me I could just make a tiny cube centered on the camera, render it first and then clear the depth buffer with a statement like this: glClear(GL_DEPTH_BUFFER_BIT); . It's only an illusion (not real rendered geometry) anyways. If you have some generic texture loading code (like me) that does things like automatic mipmap generation, you may want to bypass that as a mipmap is pointless and a waste of memory. This is especially true with detailed skybox textures. Also, you should disable lighting and other effects.

As far as overhead is concerned, you can disable the skybox when the camera is in a room without windows, etc.

If anyone has any other ideas, or disagrees with me, I'd love to know about it. This is new to me.

Share this post


Link to post
Share on other sites
Quote:
Original post by Trienco
Quote:
Original post by Mille
Later on you may want to speed up your skybox rendering using cubemaps ..


erm... how so? not that something like an old-fashioned skybox would need much of a speed boost anyway, but the only advantage of using a cubemap comes into play if you also want to use it for cubemapping on objects. else its just a fancy but useless thing to do. except you want to say that clipping a few unused quads and sending one quad instead of 2 strips or 6 quads is making any difference when looking at the fillrate its eating one way or another.

The benefit doesn't come from sending one quad vs. 6 quads, it comes from only having to set one texture and then make one draw call rather than have to set 6 textures and make 6 draw calls. API calls and texture changes are relatively expensive and avoiding them is in general a good thing, though in this case it's probably not going to make a huge difference. If you're CPU limited though (as many games still are) it will be slightly faster than making 6 draw calls.

The biggest cost of rendering a skybox is fillrate so in general you want to clear your depth buffer at the start of the frame using specific API clearing calls (rather than drawing a full screen quad) which sets up the hierarchical z buffer on modern cards then draw your scene (in roughly front to back order) and then draw your skybox last with it's z value set to the maximum z. Doing it that way gets you early z rejection on pixels where the skybox is hidden by other objects which saves fillrate. Drawing the skybox first without writing z, whilst it's a nice simple approach, means you write every pixel with the skybox colour and then overwrite many of them with your scene and so wastes fill rate.

As usual, these sorts of optimizations are not worth worrying about until you've profiled and identified this area as a bottleneck. If you do find yourself fill rate limited though it can be worth arranging your sky box rendering like this.

Share this post


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

  • 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!