iDevGames Forums
Seams showing on my cubemaps - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Seams showing on my cubemaps (/thread-4704.html)



Seams showing on my cubemaps - TomorrowPlusX - Dec 14, 2005 04:38 AM

Following a recomendation from Nicholas Francis in my "Making Trees" thread, I've transitioned from spheremaps to cubemaps to make my water look specular and shiny and all that.

Trouble is, my cubemaps show seams where the edges join. Attached are a couple screenshots showing what I'm talking about ( it's a little subtle in a screenshot but very obvious when "live" ).

[Image: Screenshots-2005-12-14-03.png]

[Image: Screenshots-2005-12-14-05.png]

In both shots you can see a zigzagging grey line in the water going roughly from top to bottom.

I know that my actual cubemap images tile, because they're very simple. I'm using add-signed blending so the cubemaps are just middle grey ( 128 ) with gradients to emphasize global lighting.

Initially I figured it was a mipmapping issue, but I see the problem regardless of wether I load mipmaps for the cubemap.


Seams showing on my cubemaps - NCarter - Dec 14, 2005 06:56 AM

You most likely need to turn on clamp-to-edge for the offending textures:

Code:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);



Seams showing on my cubemaps - TomorrowPlusX - Dec 14, 2005 11:33 AM

That did the trick -- thanks!


Seams showing on my cubemaps - arekkusu - Dec 14, 2005 11:48 AM

CLAMP_TO_EDGE fixes mipmap 0, but at smaller levels, if you used regular gluBuild2DMipmaps, it's likely that the averaging will still cause visible seams at the edges.

Depending on the size of the cubemap, this may be very minor. But to be absolutely seamless you'd want to compute the edge texels of each face averaged with the edge of an adjacent face. In a perfect world, you'd just submit textures with borders and the hardware would do this at sample time, but no consumer hardware currently supports border texels.

ATI has a nice writeup (and Windows tool) for solving exactly this problem with smarter filtering. Worth reading...


Seams showing on my cubemaps - TomorrowPlusX - Dec 14, 2005 12:56 PM

That's really quite interesting -- I'd love to have such a tool for OS X ( since I don't even *have* a PC ). Oh well.

Regardless, it's interesting to see the discussion of using the 4x4 mipmap level for burnished metal/lighting effects. I'm going to have to look into that.