## Recommended Posts

MARS_999    1627
I have a Skydome somewhat coded up. After I started working on it why couldn't one use a gluQuadric instead as a skydome? Is the only reason why people don't is becuase its a waste of polygons to render the other half? Thanks

##### Share on other sites
MARS_999    1627
You can make a sphere with it. You use this

sphere = gluNewQuadric();gluQuadricDrawstyle(sphere, GLU_FILL);gluQuadricNormals(sphere, GLU_SMOOTH);gluQuadricTexture(sphere, GL_TRUE);gluSphere(sphere, sphere_size, 90, 90);

Something to that effect...
I am just looking for why people don't use that instead?
+/-'s

##### Share on other sites
Quote:
 Is the only reason why people don't is becuase its a waste of polygons to render the other half? Thanks

You might potentially need the other half, if for example your camera is very high up; so it's not necessarily a waste. The performance cost is going to be negligable anyway, unless it's highly tesellated.

##### Share on other sites
Well, if your ground plane (by ground plane I mean the lowest height) goes straight in the middle of the sphere, then I guess the other half is wasted. GLU is open source, right?
Can't you just hack that function so it will draw a semisphere?

##### Share on other sites
kburkhart84    3187
Quote:
 Original post by RaduprvWell, if your ground plane (by ground plane I mean the lowest height) goes straight in the middle of the sphere, then I guess the other half is wasted. GLU is open source, right?Can't you just hack that function so it will draw a semisphere?

You probably could, but it really is a waste. When done right, a box works just fine if you use seamless textures and move it with the camera, you can't tell that it is a box. If you do use a quadric, either sphere or cylinder(hint, hint), You only do it once for the skybox so the polygon waste doesn't have much of an effect. If there is a noticably difference, the problem isn't in the quadric, rather maybe the system or the video card. The box is probably the best option, it has a good result and only is six polygons, five if you are on terrain and can't see the bottom anyway. If you worry about the performance hit of a quadric, how do you plan to get any realtime simulations up anyway? Anything that looks good in 3d will have many more polygons than any sphere or cylinder that a quadric comes up with.

##### Share on other sites
The box still looks ugly, you can tell it's a box.

##### Share on other sites
mikeman    2942
Quote:
 Original post by RaduprvThe box still looks ugly, you can tell it's a box.

If the textures are seamless,and of course you don't shade the box,then it's perfect.There's no way anyone can tell that it's a box.

##### Share on other sites
Quote:
 Original post by RaduprvThe box still looks ugly, you can tell it's a box.

Not unless you're doing it very wrong. I use 6 textures rendered from a 90 degree FOV in bryce. The textures are rendered with clamp to edge. There is no way you can tell it's a box; the effect is identical to if the scene was rendered that way in real-time (except obviously it doesn't move when the camera is translated).

##### Share on other sites
jakem3s90    437
The only thing I've noticed when using a Sky Box, is that when I start using fog in the scene, the corners have denser fog, since the the corners are farther from the camera, making it look like a "box", even though the textures are seamless.

##### Share on other sites
_DarkWIng_    602
jakem3s90: Don't use fog, lighting or anything like that for skybox (or skydome).

##### Share on other sites
mikeman    2942
Quote:
 Original post by jakem3s90The only thing I've noticed when using a Sky Box, is that when I start using fog in the scene, the corners have denser fog, since the the corners are farther from the camera, making it look like a "box", even though the textures are seamless.

The skybox is just used to create an illusion.There's no actual geometry in it,so you can't use GL fog.After all,the background textures are pre-rendered,so you can for example tell your artist to make background objects that are supposedly further from other objects look "foggier".I suppose with little experiment you can seamlessly mix that effect with the GL fog used on real objects.
Although there's another option.Apart from the 6 background textures,you can have another set of 6 textures that encode the xyz position of each background pixel,and the normals,assuming you can obtain that information.Maybe use floating buffers for that.That way,you can achieve real per-pixel lighting and fog even at the background.It will allow you to make cool lightning effects,for instance.Something similar to deferred shading.That won't work on pixels that represent sky,for instance,so I guess you will need alpha testing or something to shade only the pixels that belong to solid objects,like mountains or buildings.

##### Share on other sites
kburkhart84    3187
You know that with lighting, fog, etc..., you can turn it off for certain polys. So draw the skybox(as a box) with none of that on, then turn it on and draw your scene. You'll get the skybox right, but the rest will still be fogged etc... And with seamless textures, you can't tell it's a box. About the camera, just translate the box to center on the camera always and it will look very far away always. Where you put the camera, just do the same translation.

##### Share on other sites
DerAndiY    128
What the hell are seamless textures and how to create them??
Cheers
Andy

##### Share on other sites
_the_phantom_    11250
textures without seems... [grin]
Basicaly, the idea is that when applied you cant tell where one texture starts and the other ends, like... well hung wall paper...

##### Share on other sites
DerAndiY    128
Har, yepp sometimes one really should take it literally.
Thanks anyway :-)
Cheers
Andy

##### Share on other sites
Quote:
 Original post by jakem3s90The only thing I've noticed when using a Sky Box, is that when I start using fog in the scene, the corners have denser fog, since the the corners are farther from the camera, making it look like a "box", even though the textures are seamless.

Yeah, and I suppose it looks like a cube in wireframe mode too...

##### Share on other sites
mikeman    2942
Quote:
Original post by benjamin bunny
Quote:
 Original post by jakem3s90The only thing I've noticed when using a Sky Box, is that when I start using fog in the scene, the corners have denser fog, since the the corners are farther from the camera, making it look like a "box", even though the textures are seamless.

Yeah, and I suppose it looks like a cube in wireframe mode too...

You're mean.

##### Share on other sites
_DarkWIng_    602
Quote:
 Original post by benjamin bunnyYeah, and I suppose it looks like a cube in wireframe mode too...

[grin][grin][grin]

I have to remember this one...

##### Share on other sites
MARS_999    1627
I guess I need to clarify what I want. I want to be able to do dynamic clouds across the sky and a skydome or skyplane I think is the only way to do that? Skyboxes just will not look right? Plus you can tile a texture for clouds on a skybox? and you end up using a very large texture to get good detail? Help set me straight if I am wrong on this??? Thanks

##### Share on other sites
In a static image (screenshot) they look just fine, but if you move the camera, you can see that it's a cube. The background doesn't move like a circle, but like a cube. Not very visible, but the effect is there.
OTOH, using a semisphere will add only a little more geometry (usually without any effect on the FPS), but it will look better, and you can do fancy stuff like coloring the sky nicer at sunset/sunrise, etc.

##### Share on other sites
Quote:
 Original post by RaduprvIn a static image (screenshot) they look just fine, but if you move the camera, you can see that it's a cube.

No, you can't if the textures are created correctly. If the textures are rendered correctly, then applied correctly, you will not notice that it's a cube ( assuming you don't do silly things like apply fog or lighting to it ).

##### Share on other sites
*grin*
Isn't Morrowind using a cube? Their sky is so nice looking, but the cube ruins it (I was able to see it even with textures on).
If you don't believe me, do the following experiment:
Draw the cube in wireframe, and the sphere in wireframe, then rotate the camera. You will get the same effect (the artefact, for the cube), only that it's much more visible in the wireframe case.
Besides, if you have a sphere you can safely apply the fog to it.

##### Share on other sites
Quote:
 Original post by RaduprvIn a static image (screenshot) they look just fine, but if you move the camera, you can see that it's a cube. The background doesn't move like a circle, but like a cube. Not very visible, but the effect is there.OTOH, using a semisphere will add only a little more geometry (usually without any effect on the FPS), but it will look better, and you can do fancy stuff like coloring the sky nicer at sunset/sunrise, etc.

Cubes and spheres "move" exactly the same if you're not translating the camera relative to them. A point on a cubemap is effectively a directional vector, and it behaves exactly the same as a point on a skydome, since the camera doesn't translate relative to the cubemap, the distance of each point is irrelevant. 6 90 degree FOV textures can therefore be used to render any 3D scene, assuming the camera doesn't translate, and the objects in the scene are static. This is also why cube maps are used for environment mapping.

If you have a static background, there is NO advantage to using a skydome. Aside from the lesser geometry, the cube map will generally be easier to render and texture correctly.

##### Share on other sites
Hmm...
What if the clouds move? Will it still work (without recomputing the cube map)?