Game Development Community

Refreshing heightmap in Terrain Texture Editor

by Spencer Boomhower · in Artist Corner · 02/22/2004 (5:50 pm) · 14 replies

I've noticed sometimes when I'm using the terrain texture editor (f8 when you're in the level editor mode) the heightmap displayed doesn't match up with my terrain. I'm guessing the heightmap is based on an earlier iteration of the terrain, perhaps as it was before I started hand-editing the terrain. Naturally, the problem with this is that it'll apply textures in the wrong places when I use the automatic texture application tools - you know, the ones that apply the textures according to height and slope.

So the question is, does anyone know how to get the texture editor to apply textures according to the contours of the current terrain? It seems like I need a way to get that height map image to refresh.

Many thanks in advance.

-Spencer

#1
02/28/2004 (12:31 pm)
Just giving this a bump in case the one in a thousand person who can answer this missed it the first time around.
#2
02/28/2004 (3:03 pm)
This doesn't really answer your question, but what I do is make my heightmaps in Terragen, then import them to Torque and I get the map exactly the way I want it.
#3
02/28/2004 (4:03 pm)
If you tell me the type of the gui control (the gui editor can tell you this), I'll take a look at the problem.
#4
02/28/2004 (4:57 pm)
@Ben, I'm not sure what control you need, but it appears that the work of applying the textures based on the terrain starts from: Texture::applyMaterials() in editorGui.cs.

@Spencer, here is a small workaround. After you have finished editing the terrain to your likings, save the mission(to a new name), exit and reload it. open up the terrain terraform editor (F11 then F7) then under the menu, select file then export terraform bitmap. This will produce a hieghtmap of the existing (edited) terrain, which you can then use as the basis for applying the textures. Though you may need to restart torque again before it will see the new png.
#5
02/28/2004 (4:58 pm)
@Willbkool - Even if I did that (and I do like that method sometimes), I'd be changing the terrain (small tweaks for gameplay) once I got it into the editor. After that, I think I'd still have the same problem: changes I make to the terrain aren't reflected in whatever heightmap the Automatic Texture Application tools use to apply textures.

@Ben - Thanks very much for the offer. I'm afraid, however, that the GUI editor is the one part of the tools I've never touched. I don't even know what the definition of a 'GUI control' is. I tried to figure out the editor enough to get you what you need, but I had no luck. The F1 help file said something about the GUI editor being made up of a bunch of different panes that I would see when I pressed F10, but I didn't see anything like that. Then, after I'd opened and closed the GUI editor mode a few times, my screen turned green and I about freaked. Figured I'd better not mess with it anymore.

Could you tell me the exact steps to get the exact information you need? I'm working within the latest GG Torque demo (the nice promo for the Torque engine where you can choose a racing game or the multiplayer FPS, and see a walkthough of the features) if that helps. I hate to create a bunch of work for you, but I really appreciate the offer of help.

-Spencer
#6
02/28/2004 (5:00 pm)
@Martin - Thanks for the tip, I figured there might be a trick like that I could try. I'll give it a shot first chance I get.

-Spencer
#7
02/29/2004 (2:06 pm)
@Martin - I looked into what you suggested, and while I'm not sure I was able to follow your instructions perfectly, I had some luck (more below). However, when you say "you can then use (the .png) as the basis for applying the textures," do you mean somehow re-import the .png? The only way I could see to import a .png was to import it to the terrain via a "Bitmap" terrain operation. But in my case, since I'd changed the altitude of my terrain with tweaks, that ended up messing up the vertical scale of my map. Is there another way to import a .png I'm not aware of?

@Anyone who's interested - In general what I found is that the heightmap display is flakey, but not hopeless. For instance, after making a change to the terrain, I saw that the heightmap displayed in the Terrain Texture Editor (F8) hadn't updated. Further poking around revealed that the heightmap had failed to update *only* in the first material in the list, and in the the first material's operations, such as Place by Height, and Place by Slope. When I clicked on other materials (and their operations) further down the list, they showed correct heightmaps. Then, when I clicked back to the first material, it still showed the old map. I then switched to Terraform (F7) mode, and *it* showed the old map. But this was only the case until I clicked on the "0 General" in the operations list, at which point it updated to the correct map. I then hit F8 again, clicked the first material in list, and it was still wrong. Went back to F7, and it was back to being wrong (!) - until I clicked "0 General" again, at which point the correct heightmap appeared. So it seems that the display of the incorrect heightmap carried over from the first material in F8 to the Terraform display in F7 - until I tricked it into refreshing.

I should probably post a bug on this, but I couldn't get it to repeat in exactly the same way.

-Spencer
#8
03/01/2004 (5:25 pm)
Yes, you can use the exported png for the hieghtmap for the level. in the editor (F11-F7) under the "0 General" selection you mentioned, there is a listing "1 Bitmap" This dialoge will allow you to choose a png for the hieghtmap of the mission. I have found that the texture placement uses any map specified here for texture placement wether or not the terrain has changed.(Although I have been using custom made hieghtmaps for terrain anyway)
#9
08/25/2004 (3:12 pm)
Martin,

I don't think I really grasped what you were saying way back when you wrote your reply. I just had the same problem crop up, however, and while my hacky fix didn't work, yours did. Thanks!

-Spencer
#10
01/30/2005 (10:58 am)
WillBCool:

how do you actually import the heightmaps from Terragen to torque.. its trying to save it in a srf format and I cant seem to change that.
#11
03/09/2005 (10:56 pm)
I just ran into this problem doing some heavy terrain work on my level. It is an annoying problem indeed!

the problem with exporting the terrain to a png then reloading is that when you reload it, it will position the bitmap centered where you are...either that or it exports it centered where you are, I didn't double check. Key problem: the terrain you import will not necessary be positioned exactly where your original terrain was

the problem then happens that I've already laid out a laaarge number of shapes and interiors in my level. So it's unreasonable to move them into the new proper position and it's very difficult to get the terrain moved into the perfect position.

I'll look into this a bit, but if anyone else has fixed this problem do tell!
just so it's clear
the problem that needs fixing isss.
Sometimes the height data that the Terrain Texture Editor uses is not the same as the current height data. For instance if you've done lots of hand editing of the terrain making walls / canyons etc the auto terrain texture maker doesn't use your changes, it thinks it's still using the original height map


thanks,
clint
#12
03/09/2005 (11:34 pm)
Quote:the problem with exporting the terrain to a png then reloading is that when you reload it, it will position the bitmap centered where you are...either that or it exports it centered where you are, I didn't double check. Key problem: the terrain you import will not necessary be positioned exactly where your original terrain was

ok I double checked it exports it fine...it repositions the terrain if you hit the apply button on the terrain terraform editor after choosing your newly exported heightmap for the bitmap. You need to just choose the new bitmaps, save your mission without applying, then restart the app.
#13
02/11/2009 (10:23 am)
Ahem... this problem STILL exists... This entire feature is essentially broken so far as I can tell.
#14
02/11/2009 (11:40 am)
By the way, I "fixed" this (while probably breaking some other feature) by commenting out this line in terraformer.ed.cs in Heightfield::eval():

// ETerraformer.setShift( getField(%data,9), getField(%data,11) );

and these two lines, same file, in loadFromScript():
// %x = getField(%data,7);
// %y = getField(%data,9);