A nice 3D sky & cloud technique

Today I came across the “skybox” technique, where you surround your 3D scene with a cube textured with images, one per side, that allow you to turn in any direction and see the sky and a distant horizon. I found the cube edges were obvious, though, and it didn’t work too well for me.

However, texturing a sphere (and putting yourself on the inside) works. It’s known as a sky dome because you only texture the top half. It means you can give your scene a realistic sky in any direction.

http://www.youtube.com/watch?v=XysEtXqktmY

http://www.youtube.com/watch?v=kddJigO8FuA

I used Jmv38’s sphere code and an image off the internet to produce this very easily. I guess you could use your own panoramas if you can take 360 degree photos.

@Ignatz this is just amazing :o at how much fps does it run?

about 60FPS

that’s amazing, I’m not into 3D stuff yet, but I might ever use this method once I get there :slight_smile:

Very nice, as usual.

Correct me If I’m wring, but the “SkyBox” technique has also been used in the FPS Genre of games, right?

Hi @Ignatz,

Used this technique with a space background and JMV38’s globe software. Always found that you can see the join in the image used for space. Have you found any way to generate an image that wraps fully without joins. Also - have you to match the image size correctly - found sometimes gaps when I used smaller images. Still working on an app with this - will post when it’s finished.

Thanks,

Bri_G

B-)

p.s. thanks for the lighting pdf, always on the lookout for your work.

@Bri_G - I got joins with the skybox but not with the sphere, as you can see from the video. It wraps very smoothly. The image needs to be twice as wide as it is tall, to fit on the sphere.

@JustinDrake - I don’t know where skybox has been used. I can’t be doing it right because it doesn’t look good at all and I can’t get rid of the joins…

@Ignatz i am so happy this poor 3D code of mine is still useful to someone! Thanks!
However i thought your more recent ‘sphere shader’ would work simpler and faster to make textured spheres… Have you tried it?

@Jmv38 That only creates the image of a sphere though, doesn’t it? Not an actual mesh and texcoords.

@SkyTheCoder correct. And it may not work from inside, while this works with a mesh.

Yep, you can’t get inside the shader sphere, it is just a fake.

@Ignatz https://developer.valvesoftware.com/wiki/3D_Skybox this implementation :wink: That’s brilliant, I’ve always preferred sky boxes over sky domes. The domes seem to act weirdly towards the top of the dome, due to the triangles coming in to a point I’m guessing. But a 3d environment in the skybox is a level up!

The advantage of a box is that you don’t have to warp the photographs to make them look right and it has far fewer vertices than a sphere.

Maybe I wasn’t doing it right, because the images looked square at the corners

@Ignatz if you use a normal image and map it onto a mesh then a cube mesh will have a lot of distorsion, and a sphere mesh a few. But, if you invert-distort the image before applying it onto he cube, then you can have it look good. The invert-distorsion should look more or less like a cushion distorsion.

I was using an image created specially. Anyway, I prefer the dome…