April 25, 2024, 03:31:53 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


3D Skyboxs?

Started by Kale, September 11, 2006, 02:23:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Kale

Any plans to support proper skyboxs for the 3D engine?

kryton9

Kale, most skyboxes  and skydomes are just models you make and texture and bring in. At least the few languages I have played with 3d.
I will try to make one and make an example with Aurora. Hope to be back soon with an example :)

kryton9

Ok these are probably the worst sky box and sphere I have ever seen, But I didn't want to spend too much time on them.

You can use my model viewer to load them up and see them.  Turning the Autolight on and off    the U key, effects it somewhat too.
Without game elements nearby it looks even more goofy, but with a game in place you could get by for backgrounds even with these goofy things.

http://www.ionicwind.com/forums/index.php?topic=776.0

Kale

September 13, 2006, 01:51:41 AM #3 Last Edit: September 13, 2006, 01:53:19 AM by Kale
Quote from: kryton9 on September 12, 2006, 04:15:24 PM
Kale, most skyboxesÂÃ,  and skydomes are just models you make and texture and bring in. At least the few languages I have played with 3d.
I will try to make one and make an example with Aurora. Hope to be back soon with an example :)

Nope, Skyboxes are cube models but they achored at the lowest z-index and move with the camera. Thus, they cannot be modified once created, they are always unreachable when moving around in the 3D scene and always appear behind everything else thats drawn. Just like Sky! ;)

J B Wood (Zumwalt)

I would like 2 different types of skyboxes, cube and sphere.
Obviously, the cube is easy to do even for me, since the cube is 6 flat planes with them always facing center world, the sphere on the other hand, needs to allow the textured surface to be on the inside of the sphere instead of outside, this way the sphere just wraps the scene and we can apply texture to the sphere and it is inverted to the inside of the sphere instead of the outside.

To create a skybox, first you make a long image, then chop it up into 4 sections, then take the top and bottom of those and pull them off to complete the other 2 images needed for the top and bottem, then you simply create 6 flat planes and make them into a very big cube with all faces facing your world center. Finally just attach the images to the flat plane's and wham, skybox.

Kale

Quote from: zumwalt on September 13, 2006, 06:39:37 AM
I would like 2 different types of skyboxes, cube and sphere.
Obviously, the cube is easy to do even for me, since the cube is 6 flat planes with them always facing center world, the sphere on the other hand, needs to allow the textured surface to be on the inside of the sphere instead of outside, this way the sphere just wraps the scene and we can apply texture to the sphere and it is inverted to the inside of the sphere instead of the outside.

Using a textured sphere is a bit more crappy than you might think, especially at the very top of the sphere mesh, where the top two corners of the mesh texture is squashed together with the top edge to exist at a single point. It kind of looks like the top of a circus big top tent, all bunched up into a point.

Quote from: zumwalt on September 13, 2006, 06:39:37 AM
To create a skybox, first you make a long image, then chop it up into 4 sections, then take the top and bottom of those and pull them off to complete the other 2 images needed for the top and bottem, then you simply create 6 flat planes and make them into a very big cube with all faces facing your world center. Finally just attach the images to the flat plane's and wham, skybox.

I think i read in the method descriptions for primitive meshes (i.e. cube) that Aurora supports a 'bInside' method parameter. This might be for turning the mesh inside out for texturing the inside. Need Paul to clarify though. ;)

Also it's not as simple as just placing a box at camera coords and textured on the inside. As 3D worlds can be massive (think space games) and this box still needs to encapsulate everything (all planets) and never be reachable. Also, if you look at a true skybox texture, it always stays the same size no matter where you are in the 3D world, so you cant simply scale the box. :)

J B Wood (Zumwalt)

I'll throw this together in my tank game to show you want I am talking about.
I'll also look at the primitives, your probably right, but I am still leaning towards using flat planes with the facing being that of the world center.

Ionic Wind Support Team

I will look into skyboxes.  You could just make an 'inside' cube, evironment map a sky texture to it, or create one in a good texture editor,  and then just update it's position everytime the camera moves.  In otherwords the center of the cube is always at the camera position.

And yes that is what the 'bInside' parameter of the mesh creation methods are for.  It reverses the culling so textures appear on the inside of objects.

Ionic Wind Support Team


kryton9

Yes, you update the sky (box or dome) to be centered with the camera. The main thing is the lighting settings, so you don't see the corners and of course nice textures.

Kale

Attached is an example of a skybox using the OGRE engine. Notice it doesn't matter how far you pull away the skybox always encapsulates the 3D scene. I'm sure skyboxs just aren't a scaled cube. I'm not sure though, i may be wrong. ;D

Cursor keys to move - ESC to quit.

http://www.kalekold.net/Aurora/Misc/SkyBox%20Example.zip

kryton9

Kale, for some reason, I missed your post when it was new.

Did you write that in Aurora tied in with Ogre? If so, fill me in, wow.

You don't scale the box continuosly, you just have it move with the camera (player), this way it is always the same distance away from the camera so it seems very far away.
psuedo code:

get camera position
set skybox position (camera position)

I know it works because I used it all the time in DarkBasic Pro.


Kale

Quote from: kryton9 on September 20, 2006, 02:46:09 PM
Kale, for some reason, I missed your post when it was new.

Did you write that in Aurora tied in with Ogre? If so, fill me in, wow.

You don't scale the box continuosly, you just have it move with the camera (player), this way it is always the same distance away from the camera so it seems very far away.
psuedo code:

get camera position
set skybox position (camera position)

I know it works because I used it all the time in DarkBasic Pro.

That little demo was put together using another language. :-[

You say that you just move a cube with the camera, i remember years ago when i used to do the exact same thing using DBPro and i found that once you had a large 3D scene you had to make a gigantic cube at least twice as big as the farthest point across in your 3d scene. This is because when you move to the edge you are in the middle of the cube (as it travels with you) so from the middle to the outer edge must be the same distance as the scene is long or else things start to go missing because they go passed the outside of the cube. Do you get what i mean? :)

I've just been looking on the net and found a simple link:
http://gpwiki.org/index.php/Sky_Box

Quote
When you draw the skybox, you make sure z-writing is off (glDepthMask). Then you turn z-writing back on and draw your scene.

Aha! So that's it, you have to turn off z-writing to draw the skybox. This makes sure you can use any size box as long as it is between the camera's near and far clipping planes. See, i told you there was more to a skybox than just a cube, he he... :D I should try to explain better next time.

So a question to Paul is can we have this implemented please? ;D

kryton9

I am for the easiest method to use skyboxs and domes, if Paul can make it easier, I am all for it. The method I mentioned works if you needed something now, it is far from perfect however. Needs great textures and planning and lighting settings to pull it off, something in Aurora I haven't been able to do yet.

Sean

Hi Kale,

The trick is to draw the skycube first. Since you can't change the draw order with DB your correct in that it requires a huge skybox which causes clipping issues due to draw distance. Always used the draw first, small scale, move with camera skybox in Blitz and it looked great. Using/Disabling the z-buffer is ok but causes problems if you want some transparent cloud planes etc.