Game Development Community

Terrain Blending Error

by Roland Stralberg · in Torque Game Engine Advanced · 07/12/2004 (2:25 pm) · 19 replies

I notice that the bug described in Terrain Blending error fix on Jan 21, 2003, is still not fixed. The thread describes how to manually fix the bug in TGE ( not TSE ).

Suggestion:

1. Give a instruction on how to manually fix this in TSE
2. Add the fix in the next CVS update

Thank's
/roland

#1
07/12/2004 (7:28 pm)
TSE has a rewritten blender. It should not have this problem. If it does, let me know!
#2
07/13/2004 (2:52 am)
Yes. This problem exists in TSE also. I have included some pictures from TSE showing that.

Texture tiled in game

Texture used

Texture tiled on my desktop

Here is my code in missionfile

new TerrainBlock(Terrain) {
      rotation = "1 0 0 0";
      scale = "1 1 1";
      detailTexture = "~/data/terrains/ground_256";
      terrainFile = "./flatzero.ter";
      bumpTexture = "~/data/terrains/ground_256";
      squareSize = "8";
      bumpScale = "1";
      bumpOffset = "0.01";
      zeroBumpScale = "8";
      position = "-1024 -1024 0";
      locked = "true";
   };
#3
07/13/2004 (8:58 pm)
Mysterious!

I will have to look into this when I reintegrate terrain texturing with the new terrain engine I've been working on. Perhaps it's a UV co-ordinate generation problem.

I can't apply Clark's fix because we don't use CPU generated textures in TSE - it would be obscenely slow to generate the texture, dump it system memory, tweak it, then reupload it!

Good eye, though. Thanks for providing the pictures - I'll be sure to watch out for this issue.
#4
07/14/2004 (12:03 pm)
I don't know if the white jaggies in attached screenshot
are a consequence of the blending problem mentioned, but
they aren't nice to look at.

White jaggies

Perhaps I'm doing something wrong and that causes the problems.

- What are your recommendations regarding texture size. I have used 256x256.

- Are there other considerations regarding terrain texturing that can influence blending?

I have used a bitmap as heightmap. It's totally flat... a single gray bitmap with RGB=7F7F7F
with a size of 256x256 (In the 'White jaggies screeshot I have used the Terrain editor to make a small hill though).
You may check my very simple heightmap here.

- Can this maybe be the source of the problem?

I'm always using the latest TSE version from CVS.
Hope this will help

Kindly
/roland
#5
07/14/2004 (2:59 pm)
Mysterious. That looks like a gap in the terrain geometry, not related to the terrain texturing. It might be happening at a block boundary.

Another thing I will have to look into. Again, good eye... Thanks for the accurate and thorough bug reports. Tell me if you find any other subtle issues like this. I will make sure that the terrain rewrite doesn't have those problems.
#6
07/15/2004 (5:15 am)
The white jaggie can also be due to problem with mipmap textures (wrong mipmap). It was a bug I had when I changed the mipmap code and corrected it.
#7
07/15/2004 (8:18 am)
That's a possibility, although I've also seen those particular white jaggies (vary narrow line along a geometry boundary) in my rewritten terrain which is currently using a filler texture with working mip levels.

You could test pretty easily to find the problem - just make the fog color bright pink and see if the jaggies change color.
#8
07/15/2004 (9:07 am)
I've noticed this on interiors too, it only seems to appear when I have AA on and it only started when I switched from an nVidia GF2 to an ATI 9600.

The problem appears to happen when the texture is near the last mipmap. For-instance, when you're really far away or when the viewer's los grazes an objects surface.


I've seen problems similar to this before, basically loading mipmaps into OpenGL by default assumes 4 byte aligned pixel rows. This will work on all texture sizes other than 2x2. To fix the problem I had to call 'glPixelStorei(GL_UNPACK_ALIGNMENT, 1)' before loading the textures.

I'm not sure this is the same issue (because AA shouldn't affect it), however it can be tested by creating an interior with a 2x2 texture and viewing it in the engine. If it looks screwed up this is probably the problem. I would check it out now myself, but I'm nowhere near Torque at the moment.

-John
#9
07/15/2004 (9:37 am)
White jaggies can also be a video driver issue...

Edit:
To clarify...
I have seen white jaggies on my old Ti 4600 when it was overheating. I have seen white jaggies when my bios was improperly configured. I have seen white jaggies on certain video drivers when vsync was disabled. Stuff like that...I just want to make sure we are barking up the right tree before Ben has to invest a ton of time in this. Thank you for your dilligance in getting this matter solved though =)
#10
07/15/2004 (9:40 am)
Testing jaggie's with fog color variations.
TSE + Windows XP + GeForce FX 5200

White fog gives white jaggies

pink fog gives pink jaggies

Orange fog gives blue jaggies
#11
07/15/2004 (10:18 am)
Another more illustrative example of Blending problem

Texture used (256x256 png)


Blending error in terrain (TSE)

Can anyone repeat this problem or am I the only one?
#12
07/15/2004 (1:18 pm)
The jaggies are the result of an infinitesimal gap in the terrain geometry. I'll see what I can do about that.

Thanks for the great error case for the blending stuff. I will be using that test texture in the future to make sure my blending code works properly!
#13
07/15/2004 (2:11 pm)
Ben

I was using wrong texture in the sample posted Jul 15: 2004 19:18 CEST. Sorry for that.
I have corrected this now, so use the texture that is on the website now.

Texture used (256x256 png)

Texture tiled on my desktop

Blending error in terrain (TSE)
#14
07/15/2004 (3:47 pm)
Um, do you realize that texture has a couple of strange dark lines on it in the upper left and lower right? They are running parallel to the yellow/black lines.
#15
07/15/2004 (4:04 pm)
I bet those are from a tiling filter...
#16
07/15/2004 (4:06 pm)
Wow that's hard on the eyes...

Anyway the byte alignment code I mentioned earlier has already been implemented in TGE's platform specific code (for instance 'winOGLVideo.cc' line 924), so unfortunately that's not the issue I'm seeing.

I've started a new topic here to gather information regarding this issue. Any ideas are welcome.

-John
#17
07/15/2004 (7:50 pm)
The jaggies in this thread are due to some sort of inaccuracy in the texture co-ordinates for terrain.
#18
07/15/2004 (7:57 pm)
Ben, the terrain textures are clamped, because they aren't necessarily tile-able (due to the blending process), right? If so the lack of filtering on the edge texels can create sharp lines like Roland's last screen shot (but not like the first few).

Edit: I take that back, the first example also fits (just not the one with the non-tile-able texture).
#19
07/16/2004 (1:04 am)
Ben.

I know about the strange dark lines.
Yes! They are from a tiling filter in GIMP.