How do I use skyboxes?

Blitz3D Forums/Blitz3D Beginners Area/How do I use skyboxes?

Crazy4Code(Posted 2005) [#1]
I downloaded a free skybox. It came in a zip file with 6 images (one for each side) and a rwx file. What do I do with these? How do I use them in Blitz3D?


jfk EO-11110(Posted 2005) [#2]
i have no idea what a rwx file is. But I assume there are 6 or 5 textures and a mesh file.

You would do something like this:

camera=createcamera()

cleartexturefilters
texturefilter "",48 or 9
sky=loadmesh("skybox.3ds")
texturefilter "",9

entityfx sky,1
entityorder sky,1
entityparent sky,camera
...
; then somewhere in the main loop you need to rotate the sky each frame to a fixed angle.

while game ; main game loop
 ...
 rotateentity sky,0,0,0,1
 updateworld()
 renderworld()
 flip
wend

if there is no valid mesh in the zip, you may build one using a modeler and the textures.


jfk EO-11110(Posted 2005) [#3]
BTW instead of trying to make this rws file working you probably better try to find some ready to use skyboxes for blitz for now:
http://www.octanedigitalstudios.com/page4.html


Crazy4Code(Posted 2005) [#4]
the rwx file is a mesh, but I assume blitz can not read it. Can't you do something like make a box (CreateCube) and invert the faces and then texture them with the skybox textures so they are facing in towards you?


jfk EO-11110(Posted 2005) [#5]
it's a bit more complicated cause CreateCube has 6 times the same texture. But download one of the Skyboxes I linked to and reuse its 3DS file.


Crazy4Code(Posted 2005) [#6]
I'm downloading one. I'll post again once I figure out, or don't figure out what to do.


Crazy4Code(Posted 2005) [#7]
Okay, I opened the mesh into Wings and it is a box with all the textures on the inside, just as I expected, but it seems like the textures are all rotated the wrong way and stuff, like the mountains are touching the sky, not the ground. But anyway, that's probably fixed with the rotating and stuff right? And what was that texture filter thing in the code you wrote up there?


jfk EO-11110(Posted 2005) [#8]
texturefilters do the same like the texture Flags in the LoadTexture Command. But somtimes you need to use them when the textures of a mesh are loaded automaticly, This way you can affect the flags of them nonetheless. A value of 9 (8+1) is the default and you should reset it to this value after fiddling with it.

setting optional texture flags 16 OR 32 (=48) (clamp UV) will prevent the borders to be faded agains black, so your skybox won't have darkish borders/corners. You can try it without the filtering and compare the look. Now you got all the infos you need to successfully set up a skybox in blitz.

if you downloaded one of the skies by Rouge Vector, (our fellow blitz dude who kindly provides a lot of pro stuff for free) then you don't have to open it in wings. you can use the .3DS files right in blitz, although you may permanently resize his 800*800 textures to 512*512 images first.