Texture problem at atlas tile edge
by addiktive · in Torque Game Engine Advanced · 02/24/2007 (1:36 pm) · 16 replies
We are producing our landscape using a series of tiles, but at the seams, atlas is obtaining a colour from elsewhere on the texture file and overlaying it over the landscape along the seam. See below pic.
RAW file is 4097, texture file is 4096, everything else works great, so where is this texture overlay coming from, and more importantly, how to fix? it was generated in L3DT.

RAW file is 4097, texture file is 4096, everything else works great, so where is this texture overlay coming from, and more importantly, how to fix? it was generated in L3DT.

About the author
#2
If you use L3DT, check out the tools board. Jeremiah put the compiled L3DT -> atlas plugin online which does a great job in generating atlas terrains.
02/27/2007 (12:02 pm)
My unique terrains only look like this if I change scale from 1,1,1 to something different. At 1,1,1 they look correctly.If you use L3DT, check out the tools board. Jeremiah put the compiled L3DT -> atlas plugin online which does a great job in generating atlas terrains.
#3
I believe the seam is a problem involving the way texture coordinates are generated, but so far I been unable to find the place where the texture coordinates are generated.
I don't really understand this clipmap stuff, but I did actually cause the seams to disappear once by going into AtlasClipMapBatcher.cpp in the function AtlasClipMapBatcher::renderClipMap() about line 134 and changing
GFX->setTextureStageAddressModeU(i, GFXAddressWrap);
GFX->setTextureStageAddressModeV(i, GFXAddressWrap);
To
GFX->setTextureStageAddressModeU(i, GFXAddressClamp);
GFX->setTextureStageAddressModeV(i, GFXAddressClamp);
Unfortunately this change caused an even bigger problem, a "spotlight" of clamped texture that follows your movement.
02/28/2007 (12:05 pm)
I have not tried changing the scale, but at this point I'm up for anything.I believe the seam is a problem involving the way texture coordinates are generated, but so far I been unable to find the place where the texture coordinates are generated.
I don't really understand this clipmap stuff, but I did actually cause the seams to disappear once by going into AtlasClipMapBatcher.cpp in the function AtlasClipMapBatcher::renderClipMap() about line 134 and changing
GFX->setTextureStageAddressModeU(i, GFXAddressWrap);
GFX->setTextureStageAddressModeV(i, GFXAddressWrap);
To
GFX->setTextureStageAddressModeU(i, GFXAddressClamp);
GFX->setTextureStageAddressModeV(i, GFXAddressClamp);
Unfortunately this change caused an even bigger problem, a "spotlight" of clamped texture that follows your movement.
#4
If it helps, here's the code I'm using to generate the atlas terrain.
atlasOldGenerateChunkFileFromRaw16("LegendAtlas/data/terrains/Gurth1.raw", 4096, 2, 1000/65536, "LegendAtlas/data/terrains/Gurth1.chu", 0.8, 5);
importOldAtlasCHU("LegendAtlas/data/terrains/Gurth1.chu", "LegendAtlas/data/terrains/Gurth1_geometry.atlas");
atlasGenerateTextureTOCFromLargeJPEG("LegendAtlas/data/terrains/Gurth1.jpg", 5, "LegendAtlas/data/terrains/Gurth1_texture.atlas");
atlasGenerateUniqueTerrain("LegendAtlas/data/terrains/Gurth1.atlas", "LegendAtlas/data/terrains/Gurth1_geometry.atlas", "LegendAtlas/data/terrains/Gurth1_texture.atlas");
The raw file being 4097 in height & width, texture being 8192
03/01/2007 (9:11 am)
Likewise I haven't changed the scale either.If it helps, here's the code I'm using to generate the atlas terrain.
atlasOldGenerateChunkFileFromRaw16("LegendAtlas/data/terrains/Gurth1.raw", 4096, 2, 1000/65536, "LegendAtlas/data/terrains/Gurth1.chu", 0.8, 5);
importOldAtlasCHU("LegendAtlas/data/terrains/Gurth1.chu", "LegendAtlas/data/terrains/Gurth1_geometry.atlas");
atlasGenerateTextureTOCFromLargeJPEG("LegendAtlas/data/terrains/Gurth1.jpg", 5, "LegendAtlas/data/terrains/Gurth1_texture.atlas");
atlasGenerateUniqueTerrain("LegendAtlas/data/terrains/Gurth1.atlas", "LegendAtlas/data/terrains/Gurth1_geometry.atlas", "LegendAtlas/data/terrains/Gurth1_texture.atlas");
The raw file being 4097 in height & width, texture being 8192
#5
03/12/2007 (12:29 pm)
Anyone? This is quite an annoying problem. Thanks!
#6
Anyone using Atlas2 terrain should be able to see it. How well you can see it just depends on how much the different colors in each texture constrast.
03/15/2007 (2:57 pm)
I keep coming back to this problem from time to time, when I feel like abusing myself. No luck so far. I see this problem on every unique Atlas2 terrain I have processed. I have also see it on the one blended terrain I have, "arcticBlended.atlas" in the terrain_water_demo, although it seem to appear and disappear as you move along the edge of the terrain. Anyone using Atlas2 terrain should be able to see it. How well you can see it just depends on how much the different colors in each texture constrast.
#7
03/15/2007 (3:00 pm)
It's a clamping issue - during mipmapping it's sampling the texel from the other size of the map creating a half blend. Clamping UVW ops should fix the problem - though I don't know the actual command.
#8
03/19/2007 (10:50 am)
I believe I did clamp the texture with the code above. The edge/seam problem disappeared, but the area inside the clipmap was also clamped to what appears to be a single row of pixels.
#9
03/19/2007 (2:30 pm)
Can you send a pic, but this appears to be an issue that GG staff need to fix. Sounds like a bug.
#10
First, is without the changes, you can see the seams.
Next, with the changes, seams are gone, but the area inside the clipmap is clamped too.
03/19/2007 (5:27 pm)
OK this is my first attempt at posting a screenshot. Let see if can get it right.First, is without the changes, you can see the seams.
Next, with the changes, seams are gone, but the area inside the clipmap is clamped too.
#11
03/19/2007 (9:24 pm)
Nice texture... is that a DEM?
#12
03/20/2007 (7:48 am)
Actually a DEM is elevation/heightmap data. This texture is just Blue Marble July.
#13
Its been aggravating me since the new 1.03 lightmaps.
It is causing a rather odd/ugly "seam" on my spherical terrains.
No matter how I position my terrain I end up with a bright seam in a dark area or a dark seam in a bright area.
10/10/2007 (7:42 am)
Any progress on this?Its been aggravating me since the new 1.03 lightmaps.
It is causing a rather odd/ugly "seam" on my spherical terrains.
No matter how I position my terrain I end up with a bright seam in a dark area or a dark seam in a bright area.
#14
10/20/2007 (2:28 pm)
I had some seam problems and I solved the problem by reducing the error metric to 1.0.you can try varying different values for error metric and other parameters like leaf size.
#15
Changing
GFX->setTextureStageAddressModeU(i, GFXAddressWrap);
GFX->setTextureStageAddressModeV(i, GFXAddressWrap);
To
GFX->setTextureStageAddressModeU(i, GFXAddressClamp);
GFX->setTextureStageAddressModeV(i, GFXAddressClamp);
Will have the exact results that Mary is getting.
This MSDN article explains what GFXAddressClamp is doing.
And this MSDN article explains what GFXAddressWrap is doing.
After playing around with setTextureStageAddressModeU and setTextureStageAddressModeV alot and removing it all together at one point the tile edge problem still persists.
For me the seam appears when your atlas terrain is at its lowest detail level I.E.,real far away from it.
It appears to be doing exactly what Andy has suggested , tacking a sample from the opposite edge of the atlas and using it to try and blend to the next tiled section.
The problem is that the further away from the atlas you get the more pronounced it gets.
The clipmap appears to stretch the blended area more than it should. A 1 to 2 texel sample is getting streached to 10 to 20 or more.
I would really like to know how to turn this off.
For me with a lightmap applied to the atlas the seam is very apparent.
11/13/2007 (6:40 am)
Ok done some research.Changing
GFX->setTextureStageAddressModeU(i, GFXAddressWrap);
GFX->setTextureStageAddressModeV(i, GFXAddressWrap);
To
GFX->setTextureStageAddressModeU(i, GFXAddressClamp);
GFX->setTextureStageAddressModeV(i, GFXAddressClamp);
Will have the exact results that Mary is getting.
This MSDN article explains what GFXAddressClamp is doing.
And this MSDN article explains what GFXAddressWrap is doing.
After playing around with setTextureStageAddressModeU and setTextureStageAddressModeV alot and removing it all together at one point the tile edge problem still persists.
For me the seam appears when your atlas terrain is at its lowest detail level I.E.,real far away from it.
It appears to be doing exactly what Andy has suggested , tacking a sample from the opposite edge of the atlas and using it to try and blend to the next tiled section.
The problem is that the further away from the atlas you get the more pronounced it gets.
The clipmap appears to stretch the blended area more than it should. A 1 to 2 texel sample is getting streached to 10 to 20 or more.
I would really like to know how to turn this off.
For me with a lightmap applied to the atlas the seam is very apparent.
#16
But more importantly, this is clearly an engine issue that should be brought to the attention of GG.
11/13/2007 (1:52 pm)
You could expose a function to TorqueScript to toggle this. Any takers? But more importantly, this is clearly an engine issue that should be brought to the attention of GG.
Torque 3D Owner Mary Westmacott
All of my old terrains I have looked at, if I look hard enough, has the same problem so I don't think it's a new problem.
I noticed the problem just recently because like you, I was working with textures that include shades of blue for bathymetic areas and that blue line at the tile boundaries is hard to miss.