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?
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]
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]
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.
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]
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]
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
Trent (ShiningKnight)
THE Engine
trent@voxelsoft.com
You should try to set the texturecoordinates of your skybox a half texel inside the texture, so instead of having an range of [0...1], let them go from [1/512....511/512] for a texture that has a size of 256x256 pixels.
skynet
PS: I got this from quake´s source code - its sometimes like a treasure with many many small hints and solutions in it :-)
skynet
PS: I got this from quake´s source code - its sometimes like a treasure with many many small hints and solutions in it :-)
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.
glTexParameteri(GLType, GL_TEXTURE_WRAP_S, GL_CLAMP);glTexParameteri(GLType, GL_TEXTURE_WRAP_T, GL_CLAMP);
____________________________________________________________
www.elf-stone.com
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.
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!
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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement