Game Development Community

Anyone have any luck linking multiple Mega Terrains together?

by Jesse McKinney · in Torque Game Engine Advanced · 04/30/2008 (4:30 pm) · 6 replies

I was just wondering if anyone has had any luck linking multiple mega terrains together, and if so how? In reading the blog on Mega Terrains supposedly you can combine more than one Mega terrain to make an even larger terrain but I'm not having any luck doing it. I have tried moving individual blocks into alignment as well as combining all of the blocks into one mega terrain container (simgroup) but I'm still getting massive seams where the mega terrains meet.

I'm wondering if I have to do something when its compiling so edges don't form?

Any thoughts would be helpful

Video Showing what im talking about. This vid was taken after I tried combining the MegaTerrain Simgroups into one but it had the same look before I tried this:
cgeuphoria.com/AscensionFiles/MegaTerrainEdges.avi (16mb divx; Takes a minute to buffer)

First part of vid shows where mega terrains meet (seams visible), second part shows where tiles meet (no tile edges visible)

#1
05/01/2008 (12:13 am)
I get exactly the same thing.

All I noticed is that the edge of a single megaterrain (4x4) seems to render the terrain down to 'zero', so the edge of the next megaterrain will not stitch up and you see a gap. So 'all' we need to do is find the part of the code that renders the megaterrain edges down to zero ;) I looked and failed ;)

Not much help, I know, sorry!

Cheers,

Andy
#2
05/01/2008 (7:27 am)
I think this is a legacy terrain problem.

The way the mega terrain works is it takes a 512 X 512 hieghtmap and chops it into 4 256 X 256 terrains.
It then "wraps" the edges of each terrain that is not directly connected to another terrain.

Normal terrain looks like this

1 512 X 512 hightmap

________________W
-------___________north______________
-------|--------------------------------------------|
-------|--------------------------------------------|
-------|--------------------------------------------|
-------|--------------------------------------------|
----W|--------------------------------------------|W
-------|--------------------------------------------|
west-|--------------------------------------------|east
-------|--------------------------------------------|
-------|--------------------------------------------|
-------|--------------------------------------------|
-------|--------------------------------------------|
-------|--------------------------------------------|
-------|___________south____________|
_________________W

A megga terrain is like this.

4 256 X 256 hightmaps


-------_____W_____north____W_______
-------|--------------------|-----------------------|
-------|--------------------|-----------------------|
----W|--------1----------|-----------2-----------|W
-------|--------------------|-----------------------|
-------|--------------------|-----------------------|
-------|--------------------|-----------------------|
west-|_____NW_____|_____NW______|east
-------|--------NW--------|--------NW----------|
-------|--------------------|-----------------------|
----W|--------3-----------|-----------4----------|W
-------|--------------------|-----------------------|
-------|--------------------|-----------------------|
-------|____W______south____W______|
_________________W

W =Wrap
NW= No wrap

What happens is block 1's north side wraps to block 3's south side and it's west side wraps to 2's east side.

This in a nut shell is what is causing the seams.
I think there was a discussion about removing this effect in the beta.

At the least there should be an option to turn it off.

//Edit ASCII art hard
#3
05/01/2008 (7:58 am)
@ Andy
I thought that at first, but if you look 13->19 seconds into the video when the camera crosses the two mega terrains border the vertex sticking up out of the terrain are not a solid strait Z axis line, instead they are curved, at first I thought the edge vertex may have been mirrored on the Z axis but if you look closely they wouldn't line up perfectly. Which leads me to belive Bill might be on the right track with what he said if I understood him correctly.

@ Bill
Just to clarify what you are saying, basically you are saying that because the engine is trying to wrap the outside edges on opposite sides of the terrain (edges that don't meet up in the center) with each other its causing the distortion? The Mega Terrains I'm trying to link up were made from 512x512 chunks of a larger terrain I made in L3dt not from the same chunk tiled over and over, so I could see what you are saying being the case.
#4
05/01/2008 (8:06 am)
A few things to try:

1) Change the square size to 16 or 32 at creation time. (Scale your import heightmap down accordingly)

2) Connect multiple MegaTerrains via tunnels or other vis blocking constructs

3) If you really need oodles of connected and visible terrain, consider using Atlas
#5
05/01/2008 (8:27 am)
@ PG

First up thanks for making the system, To be honest this thread exists because one of the developers advertised linking multiple mega terrains together to make even bigger terrains in a GG blog and I was curious how he was able to do it as its a feature that would be really nice to see.

I originally did change the square size to make the entire terrain out of a single large square size mega terrain, but when you up square size you loose detail which might be the lesser of any other evil I propose in this post. But still something I would like to avoid if possible.

This terrain started out as a medium sized Atlas terrain. However, Mega terrains are a lot more flexible and easy to work with (it actually has in in game terrain editing tool set) which speeds up development and allows us to do more than atlas could. I have toyed with leaving this an atlas terrain but would much rather see it a mega terrain as it allows us a lot more flexibility.

I know there are downsides to using legacy blocks on a large scale but I haven't noticed any real performance issues with the current terrain I ported

Out of curiosity why 512x512 height maps? Is there an engine limitation that prevents generating seamless legacy tiles from larger images or would I just need to extend the code to accept larger height maps and generate the appropriate number of chunks?

A bit off topic but along similar lines, What is the reasoning behind Mega Terrains being generated mirrored on the X and Y axis from their corresponding height maps?
#6
05/01/2008 (9:37 am)
@Jesse McKinney
Yes. Thats pretty much the case.
It's trying to match the geometry from the opposite side of it's neighboring terrain.

I am unclear if this is absolutely necessary.
I don't see any reason why it has to be done this way.

I could be wrong.