Skip to main content
GameDev.net gamedev.net
🔒 Locked

Skybox!

Started by Coderwannabe Apr 17, 2002 at 5:55 PM 8 replies 400+ views
Original Post
Coderwannabe
Coderwannabe
Heya After coding a skybox for my litle project, i''ve noticed a rather anoying problem: the sides of the polygons of the cube that forms the box are visible, as in, separated from the rest. they seem to be cloud color, and i have no idea on how to get rid of ''em :/ ideas?
Boop Boop Beedeebee Boop!
iNsAn1tY
iNsAn1tY
Well, if you're using OpenGL for your texturing, have you put a border around the texture?

When you declare your textures, using glTexImage2D, there's a parameter called GLuint border, and it's the sixth in order of definition. It represents the width of a border, in pixels, that should be drawn around the texture. If your declaration looks like this:

glTexImage2D(GL_TEXTURE_2D, 0, 3, 64, 64, 3, GL_RGB, GL_UNSIGNED_BYTE, BitmapBits);

then you'll get a border of three pixels all around the texture, which will be the colour of the polygon without the texture on it. Change your function to look like the following:

glTexImage2D(GL_TEXTURE_2D, 0, 3, 64, 64, 0, GL_RGB, GL_UNSIGNED_BYTE, BitmapBits);

That should work, if your problem is a border.

iNsAn1tY - the place where imagination and the real world merge...
Try http://uk.geocities.com/mentalmantle - DarkVertex Coming Soon!

[edited by - iNsAn1tY on April 17, 2002 7:24:10 PM]
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
freshya
freshya
One cause might be wrapping around at the edges (it happens on my GeForce2 for some reason). If this is the case, set texture addressing mode to MIRROR and that should get rid of the seams.
UnshavenBastard
UnshavenBastard
hhmm... i think the reason is more
like, that every of the 6 faces shares vertices
with other faces, but has a different texture.
One edge of a quad is ON a line (colinear) with
the edge of another quad.
You sometimes see the last
texel-column of texture 1, but not the one
of texture 2, and vice versa, depenging on the
current view angles.

Don't know how to fix this at the moment.
But, if what I said actually causes the problem,
maybe it's worth for you to think about it,
and you find a solution to fix it.

If you get it solved, let me know.

- unshaven

EDIT:
I didn't take into account you said "seems to be cloud color".
I've seen other skybox additional wireframe-like
artifacts, obviously caused by what I just said.
Not sure if it's what your problem is.
However, anyone having such kind of problems with
skyboxes may take a look at this thread, so, information
on this speacial thing could also be useful for those.



[edited by - UnshavenBastard on April 18, 2002 7:55:46 AM]
mittens
mittens
If you don''t want a very highly detailed surrounding environment, skydomes are a very nice alternative to skyboxes. All you need is a nice cloud texture, then create a big sphere, and apply the texture. It creates very nice (and EASY) results. And you don''t have to worry about the sides showing.

Trent (ShiningKnight)
THE Engine
trent@voxelsoft.com
UnshavenBastard
UnshavenBastard

yeah, that should work. it''s so obvious.
why don''t we often see things that are so obvious...

that way, two neighboring pixels of two quads will
always have the reference to the same texel, and thus,
will have the same color, and it will not matter
if the quads don''t exactly fit together (due to floating
point rounding etc), and get a bit closer or less close
to each other.

Thanks for the tip, I can use this, too.

UnshavenBastard
UnshavenBastard

bunny,

well, I like OGL much, too, but you can''t assume
that "Coderwannabe" uses GL

and a more general answer is useful for
more people.
Coderwannabe
Coderwannabe
Dear all of you, and most especially my anounymous poster!
The solution comes to this (and anounymous poster just almost said it correctly)
instead of using 0.0f and 1.0f in the coordinate values for the cube, i used (1.0f/(TextureResolution*2)) and (1.0f-(1.0f/(TextureResolution*2))).
that made my perfect sky (or should i say, my sky perfect?)

thank you all, have a nice day!
Boop Boop Beedeebee Boop!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.