MegaTerrain Edges
by Andrew Edmonds · in Torque Game Engine Advanced · 11/19/2008 (8:29 am) · 12 replies
Hi all,
I'm sure I've seen a thread about this before but I can't for the life of me find it now. Can anyone tell me why the edges of my megaterrain look like this:

This should be a shoreline and will have a waterblock covering up the edge of the terrain but no matter what I try I still get this ugly edge to the terrain.
The heightfield is a 512x512 png exported from L3DT.
Any clues?
Thanks all...
I'm sure I've seen a thread about this before but I can't for the life of me find it now. Can anyone tell me why the edges of my megaterrain look like this:

This should be a shoreline and will have a waterblock covering up the edge of the terrain but no matter what I try I still get this ugly edge to the terrain.
The heightfield is a 512x512 png exported from L3DT.
Any clues?
Thanks all...
About the author
Formed in 2005, EiKON Games is an indie games development project based in the UK working on the tactical first person shooter "Epoch: Incursion". See the Join Us or Contact Us pages at http://www.eikon-games.com/
#2
I'll dig into the png in photoshop and see what I can find out.
Thanks.
BTW - bought your cliff kit yesterday - outstanding work!!
11/19/2008 (9:29 am)
Hey Konrad. I'll take a look. I thought there may have been a 1-pixel border causing the problem so I cropped a 510x510 piece out of the centre and then scaled back up to 512x512 but that didn't cause the problem.I'll dig into the png in photoshop and see what I can find out.
Thanks.
BTW - bought your cliff kit yesterday - outstanding work!!
#3
Let me know if I can help you with that heightmap. Send it to my email in my profile, and I'll see if I can fix it for you if the Photoshop poking doesn't work. Also, when you selected the 510x510, you probably had anti-aliasing turned off, but I'm mentioning this just in case.. That'd also create a barely-visible alpha border for the image. You could just save as jpg and resave as png though to make sure, or just paint a line on the borders with the color of the second row.
Good luck!
11/19/2008 (9:36 am)
Hey, thanks for the compliments, I'm glad you like the cliffs! There's a really cool update in the works while I'm also working on the 1.8 version.Let me know if I can help you with that heightmap. Send it to my email in my profile, and I'll see if I can fix it for you if the Photoshop poking doesn't work. Also, when you selected the 510x510, you probably had anti-aliasing turned off, but I'm mentioning this just in case.. That'd also create a barely-visible alpha border for the image. You could just save as jpg and resave as png though to make sure, or just paint a line on the borders with the color of the second row.
Good luck!
#4
I'll see what I can come up with. Alternatively, I do have a copy of Grome that is licensed for my laptop (which is sadly dead due to a fried gfx card...). I'll see if I can transfer the license to this computer and do my work in there.
11/19/2008 (9:39 am)
Thanks Konrad.I'll see what I can come up with. Alternatively, I do have a copy of Grome that is licensed for my laptop (which is sadly dead due to a fried gfx card...). I'll see if I can transfer the license to this computer and do my work in there.
#5
11/19/2008 (1:31 pm)
I'll bet dollars to donuts that that edge is lined up perfectly with the terrain edge on the opposite side of your map, and it's MegaTerrain wanting to repeat the terrain doing it. There have been posts about it before, and it also happens with my handmade terrain pngs. There may be a resource to fix it out there I think, but I'm not sure, so you'd have to do a search on that. HTH.
#6
11/19/2008 (3:13 pm)
Try either offsetting both axes of your heightmap or extend your canvas in your graphics editor to see if you see a noticable line along any edge of the png.
#7
Konrad - My grome license has been transferred to this computer and I created a terrain from scratch. When I exported the heightmap I still got the seam at the edge! I still had to open it in photoshop to reduce the bit depth from 16 to 8 bits (otherwise torque crashes) so the problem may still be in the way that they are being saved out. What would be your normal grome -> megaterrain workflow?
Thanks...
11/19/2008 (11:55 pm)
Brian, I've looked at the png very closely at the edges and there is definitely nothing there to create the sharp edge.Konrad - My grome license has been transferred to this computer and I created a terrain from scratch. When I exported the heightmap I still got the seam at the edge! I still had to open it in photoshop to reduce the bit depth from 16 to 8 bits (otherwise torque crashes) so the problem may still be in the way that they are being saved out. What would be your normal grome -> megaterrain workflow?
Thanks...
#8
So Ted is right, this is a problem in the source - more exactly in terrData.cpp in the console function buildMegaTerrain. Unfortunately I couldn't find a fix for this, so I'll just take a crack at it. I'll let you know how it goes.
Edit: accidental accented character - cut off my message. I thought this was fixed a number of times before :)
11/20/2008 (2:03 am)
I export the raw terrain heightmap to png, and rescale it in photoshop. But ... I've checked my MegaTerrain more closely, and I've found that there's one side where the terrain does the same thing, except going downwards - that's why I haven't seen it yet. This terrain is basin-like so that's why I've never seen this weird behavior on that specific side.So Ted is right, this is a problem in the source - more exactly in terrData.cpp in the console function buildMegaTerrain. Unfortunately I couldn't find a fix for this, so I'll just take a crack at it. I'll let you know how it goes.
Edit: accidental accented character - cut off my message. I thought this was fixed a number of times before :)
#9
I checked it with the terrain that comes with the T3D demo and the same thing happens as with yours - because it's a basin the sharp edges go down rather than up.
It looks to me like it has something to do with the min / max height of the terrain. But I might be wrong :o)
11/20/2008 (2:12 am)
Ah superb - thanks Konrad. If you could let me know how you get on that would be great.I checked it with the terrain that comes with the T3D demo and the same thing happens as with yours - because it's a basin the sharp edges go down rather than up.
It looks to me like it has something to do with the min / max height of the terrain. But I might be wrong :o)
#10
I'll write again when I know more.
11/20/2008 (12:45 pm)
So far I've been unsuccessful, I know that it's because of the MegaTerrain segment trying to repeat itself - so not the entire group of blocks, just that one specific block. Ted was pretty much right about everything. I've been saving raw heightmaps from the engine but I've found nothing changed in the heightmap itself, so it must be the terrain block only somewhere - I'll keep looking. I'll write again when I know more.
#11
I ran into this before Megaterrain was implemented (old legacy) and as far as I remember it was due to LOD being applied to the edges and if you disabled it, it would go away. Not a solution, of course.. if it still works, but I also recall there's a if segment in there that should make LOD disable at edges, I believe. So this really shouldn't come up to begin with :/
Bla bla bla, not sure about anything. But perhaps you're lucky.
11/20/2008 (1:16 pm)
Konrad,I ran into this before Megaterrain was implemented (old legacy) and as far as I remember it was due to LOD being applied to the edges and if you disabled it, it would go away. Not a solution, of course.. if it still works, but I also recall there's a if segment in there that should make LOD disable at edges, I believe. So this really shouldn't come up to begin with :/
Bla bla bla, not sure about anything. But perhaps you're lucky.
#12
11/20/2008 (1:26 pm)
Thanks Stefan, I'll go ahead and check that part!
Associate Konrad Kiss
Bitgap Games