Advertisement

Sky Sphere

Started by April 14, 2005 03:23 PM
9 comments, last by badskanker 19 years, 6 months ago
I'm going to want to wake a sky sphere soon. Just wondering how I go about texturing the inside of a sphere. Does anyone know? Thanks
same as the outside, only that in order to make the polygons show if you have face culling enabled, you must change either the winding order of the vertics or change witch side is the backside.
Witch can be done fairly easily with glCullFace(GL_FRONT).

use glCullFace(GL_BACK) to reset the culling.
Advertisement
Are you sure you want to use a sphere instead of a box? Anyways, doesn't make a whole lot of difference, a box just requires less time to render.

You want to turn the model insideout. All faces should "point" inward, instead of outward which you do with normal objects.

It's a lot easier to make a box, since the UV texture mapping is way easier though. It really comes down to logic. Each polygon to the right or down increments the u or v float by a percentage of 1. The amount depends on how many polygons you have for the model.

Hope this helps
Thanks for your input guys.

The Sky thing is for an a space shooter so a sphere would be ideal but perhaps I'll try a box first.

Thanks

Paul.
If you make the box nice and big, it's hard to tell it's a box.
@Simian Man : Size of box has nothing to do with how it looks. If it does then you are doing something wrong.

@Ruudje : There are reasons to use skydome/sphere instead of skybox. Sometimes domes can be used for low-frequency base color or to use some specific mapping effects that can't be made so simple with skybox.
You should never let your fears become the boundaries of your dreams.
Advertisement
Hi,

I need a fake sky for my program too, and I've tried both methods (skybox and skysphere).

About the skysphere, I must be missing something about the texture, it always looks pinched at the poles, even when I "try" to use Photoshop's polar plugin :)

But about the skybox, I read everywhere that they must be centered around the camera. That's clearly true, because if it's not we can clearly see the edges... But what's the trick if the user can move the camera freely, ie. even upwards ? If I move the skybox up, then there is a gap between the ground and the sides; and if I don't, the edges are noticable :(

How do they implement this in flight simulators (where the plane can move around freely without ever noticing the trick) ?

Thanks for your help!


Romain
The trick to rendering sky boxes and spheres and the like at the right position is the following. You always render it with the identity matrix as the world matrix, such that it is always rendered at the origin. Then you adjust the view matrix such that it will view from the origin (by removing the translation part). Regardless of the world, this will cause your sky object to be rendered around the users head.

If it is a box or a sphere with sufficient size this will always cover the whole head. If it is a dome, you might want to sink it a bit to avoid tearing at the horizon. This can be done by adjusting the translation part in the view matrix to not exactly zero but a small vertical offset.

If you see the edges of your skybox, you either have assigned a non-tiling texture or mapped it wrong or, most often, you have not turned lighting off.

Greetz,

Illco
Thanks for this really quick answer !

In fact, when I face one of the edges horizontally, there is no problem. But I can see them when I move the camera upwards, and then tilt it. Here's a screenshot of the problem:

http://i2.photobucket.com/albums/y31/bigquick/skybox.jpg

I tried what you said so that the box is always centered aroung the "head", but when I move up (the camera can be moved around freely), then the bottom plane of the skybox moves up too and it goes past the ground (the bottom plane is not used as the ground, because the latter must stay at y=0 when we go up if we want an illusion of height).

Did I miss something ?

Ehrm yeah, I missed something too. There is something else. You should always render your skybox first thing and the important thing here is to disable zwriting and ztesting. This way the skybox is always in the back of everything.

Greetz,

Illco

This topic is closed to new replies.

Advertisement