Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Best Way to Make a Sky-box?

Author
Message
QuantumPixel
9
Years of Service
User Offline
Joined: 14th Feb 2010
Location: Alabama, USA
Posted: 13th Jul 2013 00:24
Greetings all!

What is the best way to make a sky-box?

In the past, I have simply used an inverted sphere when all I needed was a sky above my landscape. And that worked well enough. But now, I am working on a game that takes place in outer space. A sphere doesn't work well in this case because it distorts the texture and blurs/stretches all the stars. A sky-box is needed, but I cannot simply invert a cube and drop a texture on it (as the image would be duplicated on all six sides.) I have tried to "build" a cube by arranging six plains in a cube shape with their faces pointing inward. This works fine on dark star-fields, but not on brighter textures, such as those containing nebulae, where the seam between plains is often visible (seen as a broken series of black pixels.) I can build an inverted cube with 3D software and import it into my game, but that would require me to combine all six of my textures into one really-large texture. That seems a bit inefficient. So what would be the best method to use?
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 13th Jul 2013 15:09
I don't think you can get around having to use large textures.

There's another method, though not that common, where you use a seamless texture and texture the backdrop with it. You then scroll the texture according to the orientation of the camera.

Quote: "I can build an inverted cube with 3D software and import it into my game, but that would require me to combine all six of my textures into one really-large texture."


This is the usual technique used in most games.

Terragen is a good tool to generate textures, and there are a lot of tutorials on how to do it on google.

TheComet

QuantumPixel
9
Years of Service
User Offline
Joined: 14th Feb 2010
Location: Alabama, USA
Posted: 13th Jul 2013 15:28
Thanks again, TheComet! That's what I was afraid of.

I will finish a game, one of these days...
Rudolpho
14
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 15th Jul 2013 18:59
Quote: "I can build an inverted cube with 3D software and import it into my game, but that would require me to combine all six of my textures into one really-large texture."

You may also make your box so that each side is a limb, in that way you can load and apply your 6 textures to each side, saving some extra memory overhead if you were to combine them into a larger texture.


"Why do programmers get Halloween and Christmas mixed up?"
QuantumPixel
9
Years of Service
User Offline
Joined: 14th Feb 2010
Location: Alabama, USA
Posted: 15th Jul 2013 19:59
That sounds like a great idea! Unfortunately, though, I have no idea how to work with limbs.

I will finish a game, one of these days...
Le Verdier
8
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 15th Jul 2013 22:26
QuantumPixel
9
Years of Service
User Offline
Joined: 14th Feb 2010
Location: Alabama, USA
Posted: 15th Jul 2013 22:34
Wow... Do you think you could have made that any more complicated?

I will finish a game, one of these days...
Le Verdier
8
Years of Service
User Offline
Joined: 10th Jan 2012
Location: In the mosh-pit
Posted: 15th Jul 2013 22:49
I agree this takes me some time...
But I needed it to gain performance as I had an old gfx card at the time...

Rudolpho
14
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 16th Jul 2013 12:34
Here's a slightly simpler example of what I suggested:


Speed would hardly be an issue since creating a skybox like this is relatively fast and is only to be done once at startup anyway.


"Why do programmers get Halloween and Christmas mixed up?"
QuantumPixel
9
Years of Service
User Offline
Joined: 14th Feb 2010
Location: Alabama, USA
Posted: 17th Jul 2013 02:53
Thank you for the code snippet, Rudolpho! That was very helpful!

I will finish a game, one of these days...

Login to post a reply

Server time is: 2020-01-20 18:27:18
Your offset time is: 2020-01-20 18:27:18