Game Development Community

TGEA 1.7.0 Beta 1 - Bug MegaTerrain Edges

by Thomas Oliver · in Torque Game Engine Advanced · 03/19/2008 (6:42 pm) · 7 replies

This bug deals with the MegaTerrain. When importing in a heightmap (doesnt matter what it looks like as long as its not flat) the edges of the 4 terrain blocks that touch the empty space has weird artifacts where the terrain does not completely stop at the edge of the terrain block. The terrain seems to suddenly jump upwards or downwards depending on different factors for one pixel beyond where the terrain should end.

This has been happening with all the heightmaps I try to import - regardless what the heightmap looks like.
Its worth noteing that the strange terrain shooting up or down seems to mirror the heighest and lowest spots in the terrain.

The terrain spots that are messed up like this are also uneditable by any of the terrain tools.

This was using the T3D Project.

i247.photobucket.com/albums/gg142/Thomaso316/sc_bug1a.jpg
i247.photobucket.com/albums/gg142/Thomaso316/sc_bug1.jpg

#1
03/20/2008 (5:33 am)
I'll confirm this bug. The odd terrain elevation happens at the exact, opposite edge of where I was editing. So if I was elevating the right edge of the terrain, the left edge starts elevating in the same manner, as in the second screenshot posted by Thomas:

Specs:
Windows XP Pro SP2
Visual Studio 2008 Express
2 GB RAM
nVidia 8800 GTS

I'm going to try compiled versions of the engine from each compiler (I have 3 installed), and see if it happens every time.
#2
03/20/2008 (5:42 am)
The is geometry wrap left over from the legacy terrain. It can be hidden by raising the terrain's walls on the edges...

It would be best to remove the edge entirely, especially as it is affecting lighting.
#3
03/20/2008 (5:44 am)
So, using the set empty tile on the rogue edge will work without affecting the real modification? I gotta try that out.
#4
03/20/2008 (6:09 am)
Hey Michael, that is a good idea... Let me know if that works out and I'll see about making it procedural in the MegaTerrain sources :)
#5
03/20/2008 (6:35 am)
Alright, I tried the set empty method before recompiling with various VS versions. I'm using a 512x512 heightmap that is completely flat, so I can better spot the problem more easily. Here's a step by step with screen shots:

Went to the center (where the four terrains meet) and used a set height brush to modify
Center Modification

Flat, rogue edge appeared on other side of the terrain
Rogue Edge Appears

Had to use a 1x1 set empty brush to remove edge
Set Empty

Was left with a small gap in the terrain
Gap

Used a 5x5 set height brush to hide gap
Hiding The Gap

Unfortunately, when I made the last modification, another rogue edge popped up on another corner. I fixed that and had the same problem on another edge. So, set empty is a temporary fix, but if you are modifying corners you will have to do a lot of rinse and repeats to get it perfect.

Without the procedural terrain system, hand modifying this large of a terrain will get tedious very quickly.
#6
03/20/2008 (6:38 am)
Thanks for the great reporting! I'll look into handling the edges better today.
#7
03/24/2008 (9:15 am)
There is a limit on empty squares as they are transfered over the networking layer. So, the "set empty" approach doesn't work. It also ends up removing a fair amount of real estate when applied to the entire terrain set.

What really needs to happen here is to get rid of the rest of the legacy terrain stuff in regards to rendering chunks as this makes it *very* difficult to work with the terrain code. It also significantly slows down the rendering on modern hardware.

For now, wherever your terrain ends make sure that the edge is brought up. It is easiest to do this in the heightmap itself. This is pretty much necessary anyway unless you want your terrain to end abruptly and drop off into empty space. If you have a rise or something in the middle that introduces a slight edge problem, you can also set empty on those edge squares.