skybox edges are visible

Started by
6 comments, last by GameDev.net 19 years, 5 months ago
Hello, i'm making a terrain viewer. results are ok except that i have a problem with the skybox : its edges are visible. does anyone has already had this problem ? picture is at : http://eldeann7.chez.tiscali.fr/error_skybox.htm the skybox edge is visible on the reflection on the water. thanks Eldeann
Advertisement
This problem is sometimes due to using the wrong sampler state. If you're using D3D try setting the sampler states ADDRESSU = CLAMP and ADDRESSV = CLAMP - the default is wrap which means pixels at the edge can filter with pixels from the other side of the texture. Using clamp stops that happening. I don't know what the equivalent setting for OpenGL is but there is probably something similar.

Another option is to render your skybox with a cubemap - that has the advantage that you don't have to change textures to render the six faces. If you want to get really clever you can use a cubemap to draw your 'skybox' with a single full screen quad and no texture changes.

Game Programming Blog: www.mattnewport.com/blog

http://www.mindcontrol.org/~hplus/graphics/skybox.html
if your under opengl look up GL_CLAMP and GL_CLAMP_TO_EDGE which have been availible since opengl 1.1.
i've been away last few days that's why i didn't answer you,
but thanks much, i'll try your solutions
i did as you said (for direct3d), and that works perfectly :

pDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU , D3DTADDRESS_CLAMP );
pDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV , D3DTADDRESS_CLAMP );


thanks much, and about the cubemap, i prefer to pay attention to performance for the terrain rendering, it's my big bottleneck yet.
try to set the texture coords such that they address the mid of the pixels rather than one edge.

like if you have a 256x256 texture,
the right upper coorner of the texture would be (255.0/256.0, 255.0 + 255.0/256.0) instead of (0.0,1.0)
you're right, setting the sampler states to D3DTADDRESS_CLAMP is not enough, it's better, but edges are still a bit visible.
i set the coordinates to ( 0.002 , 1.0-0.002) instead of ( 0.0,1.0) and that's much better

This topic is closed to new replies.

Advertisement