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.

DarkBASIC Discussion / SkyBoxes and SkySpheres (if you're smart, come here :) )

Author
Message
Uncle Sam
18
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 3rd Aug 2005 21:44 Edited at: 4th Aug 2005 02:29
I don't get it!

For the skyboxes and skyspheres, there are a whole bunch of different tpyes, and each type has several different textures of the same sky, so I don't know which one to use, and when I do use one, it just duplicates it, and I get 3 suns, and/or a nasty line or two down the sky.

Help me!!!!!!!!

--------------
Uncle Sam
Link102
19
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 4th Aug 2005 00:25
which one are your useing? Make sure you get the names of the textures right, you can open up the X. file with notepad to check the texture name (CTRL+F>***.BMP/JPG).

Don't look at my sig!
master programmer
18
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 4th Aug 2005 01:18
I've actually never used skyboxes and that stuff before. I usually just use backdrop on texture backdrop 1 and that kind of stuff. Sorry, not much help here.


__________________________________________
<<<<<Check out my sites>>>>>
www.rhettgames.tk | www.slayerbattletanks.tk
Uncle Sam
18
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 4th Aug 2005 02:30
I usually use the psd ones.

--------------
Uncle Sam
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Aug 2005 05:58 Edited at: 6th Feb 2007 16:58
First of all, you don't say how much you know about creating Skyboxes, so I'll start with the basics. Apologies if it's too basic!

This is all written for the DB Classic user by the way - not sure about DB Pro...


What Are Skyboxes?

Skyboxes are basically cubes textured with four different images to give a 360 degree panoramic view, along with the above and below views. In your program, you scale the cube up massively and place your matrix/camera in the centre so you have a nice 'backdrop' to your program - like the one used in my Waterfall Demo.

You can't create a skybox from a DB primitive cube as there's no way to texture the six individual sides of the cube. So, you have to create your skybox in a modelling program that exports .X files for DB.

I used Truespace 5 for this and it took only a couple of minutes. (You'll find the skybox.x file I created in the zip file).


OK, now for the images...

First of all, you can't use any old images. Getting the digital camera out and snapping 6 pics in each direction or trying to create them in a paint program won't work. Even if you managed to stitch them together seamlessly, there's one thing which will see your efforts completely ruined... perspective!

Images textured onto a cube are furthest away from the eye in the corners and will appear stretched. Instead of seeing a scene, your eye (and the camera) will just see a scene painted on the inside of a box! Not the effect we want...

To see this effect, unzip BadImages.zip into the same folder as the .x file and run Skybox.dba. See how it looks like you are just in a box?

So, the images are specially generated by software (like Bryce) to be 'anti-stretched' at the corners. This squashes the images slightly so when stretched in the corners of your skybox, the stretch effect is counteracted. The result is we don't see the box and it looks like a panoramic view.

You can find loads of web sites which give you free skyboxes to download - usually named 1.bmp to 6.bmp. All you have to do is get them into your skybox.

The skybox .X file I created uses 6 bmp files called Back.bmp, Front.bmp, Left.bmp, Right.bmp, Top.bmp and Bottom.bmp.

If you download skybox images off the net, simply rename the images and drop them into the same folder as the skybox.x file and they will automatically be used by the supplied .X file.


Now The Problem...

Both the images and the skybox can be created with different software to be used with different systems. Of the six images you download, which is left and which is right?

Well normally, on the web site you will see the six images displayed joined together - usually in a capital letter 'T' pattern rotated 90 degrees - looking similar to this:



Normally the three vertical images are the front view with the top and bottom attached above and below respectively, but some may show the back view with top and bottom. The three images attached to the centre image will be the remaining images which wrap round the three other sides of the cube TOWARDS YOU.

So, you rename the numbered images you downloaded as shown in the above diagram.

Finally, you may have to alter the images to fit the mapping done with the textures on the skybox.x file I have supplied. (Or you can use a 3D modelling program to create your own Skybox.x file).

GoodImages.zip contains six skybox images I downloaded off the net and renamed as described above.

When renamed, I had to alter the top and bottom images in Paintshop Pro to match the texturing method I used in Truespace for my Skybox.x file. This involved doing the following:

Bottom.bmp - a) Rotate image 180 degrees. b) Mirror (flip) Vertically c) Save!

Top.bmp - a) Rotate image 180 degrees. b) Save!

Depending on where you download the skybox images from, you may have to experiment to get it looking right. The method described here works fine with the excellent Vaxwars skyboxes.


DB Coding Hints:

Many people have said that although their skybox images work fine, in DB Classic, the effect is ruined by ugly lines along the edges of the six skybox sides.

There is a way around this, but it's a bit of a compromise.

All you have to do is use the Set Object command and set the Filter flag to 0 (zero). This lowers the quality a bit, but it gets rid of those horrible lines.

As you can see from the DBA code in the zip, I use:

SET OBJECT 500, 1, 1, 0, 0

The last zero turns the filter on. The other zero turns Cull on and this allow you to see the image from the inside of the cube as normally the insides of objects are not drawn (speeds things up - especially when they aren't normally seen anyway).

If you are new to DB, but not programming, you will like me, probably find this strange. I've always thought of 0 as being off and 1 as being on. However, in DB it's the reverse - you'll soon get used to it!

OK - that's it for now. Hope it was of some help to someone...

Oh yes - the download...

http://www.computechtenerife.com/skybox.zip

Note: The images in GoodImages.zip do not need to be altered as described above - they are already done.

TDK_Man

Uncle Sam
18
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 4th Aug 2005 07:03
TDK, thanx soooo much for taking that much time to help me.

I just have a couple of questions:

1. How does the skybox automatically texture itself?
2. Do I just make a cube in, say, Anim8or, and texture it, and then export it?

--------------
Uncle Sam
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 4th Aug 2005 07:22 Edited at: 4th Aug 2005 07:25
Uncle Sam,

1. When you save a textured .x model, its uv textured coordinates are also saved along with it. Therefore, if you texture a model in a modeler, export it, load it into DarkBasic, and then simply texture it with the same texture you used in the modeler, it will be applied the exact same way you applied it in the modeler. DarkBasic will use the model's uv coordinate perimeters , and will map(wrap) the texture around the model, according to them.

2. ...and then import it into DarkBasic, and texture it, using the texture object command.


+NanoBrain+
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Aug 2005 07:35
The sky box doesn't really texture itself - we cheat!

When you create a .X file in a modelling program, the .X file doesn't contain the images - just the filenames of the images and where they are placed on the object. A .X file is just a text file containing info that DB uses to re-create the object.

As they are only filenames of images, DB doesn't know that you've changed the images - so long as you don't change the filenames.

As for animator, to be honest I don't know as I've never used it. To the best of my knowledge, there isn't just one type of .X file. I'm no expert with Truespace (or any other modeller for that matter) - I just know that the .X files it creates are compatible with DB.

But, the answer to your second question basically is yes.

Create a cube, texture the six sides with the skybox images you download, save it as a .X file and give it a try in DB.

You then keep your fingers crossed that a) DB likes the .X format file it created and b) the images are the correct way round, (I think DB may possibly invert the top and bottom - or it may be Truespace which does this. I'm not sure!

That's why it's easier for beginners to use the Skybox.X file from my zip and alter the images to fit. At least it's a .X format DB is happy with.

Oh and image filenames must be 8.3 format for DB to work!

TDK_Man
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Aug 2005 07:46
Nanobrain is quite right... providing your texture is a single image.

We however are talking about occasions when you download a skybox as six separate images - in which case his suggestion won't work as you will end up with the same image on all six sides of your cube.

TDK_Man
Uncle Sam
18
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 4th Aug 2005 07:46 Edited at: 4th Aug 2005 07:53
Thanx again!

I don't think I'm a beginner, well kind of for DB, but not for programming, so I'll give it a go in Anim8or.

EDIT: do you know how to apply a texture from a file in Anim8or?

--------------
Uncle Sam
greg man
19
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 5th Aug 2005 20:21
to apply a texture in anim8or press the materials button (on the top tool bar) then double click on 'new'. Then click on the button with a '-' on it for diffuse(i don't thinkyou have to do it for the others) and click load texture. then select your texture ,click open and it will be added to the list of loaded textures. highlight it and click ok then ok again. now you can just select your object and click apply.
i think this may be tricky though for a sky box because the texture has to be on the inside and i think anim8or will texture the outside so you might have to make your own cube with the faces pointing inwards
Uncle Sam
18
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 5th Aug 2005 22:16
Thanx.

--------------
Uncle Sam
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 6th Aug 2005 01:22
Quote: "i think this may be tricky though for a sky box because the texture has to be on the inside"


No, not at all. Just texture the outside of your cube's six sides with the six skybox images, (in the correct places of course)!

The Cull flag in DB's Set Object command in effect, lets you see the textures from the inside. That's all you have to remember to turn on.

TDK_Man
greg man
19
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 6th Aug 2005 09:50
cool. i never knew that. i thought you would just see blank untextured surfaces
master programmer
18
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 7th Aug 2005 09:30
OK, now that I understood what skyboxes are, I found that the best way to incorporate the skies in my game was to use this code, it may not be the best for all games, I just thought this works great too:


Providing you have a sky image. (The image I use is attached)

Attachments

Login to view attachments
Uncle Sam
18
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 8th Aug 2005 06:05
Thank you everyone!

--------------
Uncle Sam

Login to post a reply

Server time is: 2024-05-03 18:33:20
Your offset time is: 2024-05-03 18:33:20