Game Development Community

Terrain texture dump

by Konrad Kiss · in Torque Game Engine Advanced · 07/18/2008 (2:25 pm) · 4 replies

Hi

Is there an easy way / implemented function to dump the blended terrain texture to a file for legacy terrains?
Same for the terrain lightmap?

I am creating a tool that lets people edit missions through their web browsers, and I need some way to actually show where they are editing an npc for example. I'm not worried about statics / interiors and such, so the terrain texture would be just enough for now.

A better solution would be to create a snapshot from above with fog off, 0 volume fogs, large visibility distance and an ortho view, but I had trouble setting the right fov for that, and that sounds complicated enough. And then I'd want the best LOD on everything, so trees don't look like a line from above with their last billboard LOD kicking in.. it could get pretty complicated, so for now, I'd just try a texture dump.

Where should I dig to find this texture object?

Any help would be very much appreciated!

Thanks,
Konrad

#1
07/18/2008 (4:33 pm)
The texture data for blended terrains is generated on the fly (that's why it's blended and not a unique texture). So there's no existing image you can dump. Also, it actually doesn't look all that great top down. You might want to try dumping the heightfield data and giving people a "black is low, white is high" image. The heightfield is only 256x256 and it's all stored in RAM all the time. You can see examples of how to get at it by looking at the terrain editor GUI controls - several of them use it to make it easier to preview the terrain.
#2
07/19/2008 (1:49 am)
Thanks Ben

Yes, getting the heightfield seemed relatively easy. I've worked on porting your CommanderMap Hud to 1.7.1, and that helped me to understand a lot about top-down terrain.

I want to present my editors some web eye-candy. That preserves enthusiasm more, and I need them to be excited about the project, so the heightmap just won't do it.

What I'll do then is I'll create a top-down cam similar to the one in your resource, except I'll take out volumetric fog, make the waterblocks less see-through, and fix the lods for objects rendered there to be the best. Once I have a correct ortho view, I'll probably automate the cam's positions to go through the entire map and get it by chunks. Once it iterated through the map, I will exit the script.

I'll work on how to put the chunks together, and finally create a map that's usable for my idea or even in-game. Once that's done, I'll update your ported resource to work from the map file instead of using a cam to take out the 2nd rendering overhead.

Well, that looks like a nice plan for the week. Thanks again for your help.
#3
07/19/2008 (5:17 pm)
Sounds like a good plan. That would make a great resource, I'm sure a lot of people would get mileage out of it.
#4
07/20/2008 (1:14 pm)
Sure, I'll post it soon enough, I just need to make it resource worthy first. :)

So far I have managed to set up the cam, take screenshots through the terrain with it, and assemble the shots into one big map with pixel correct positions.

I still have to crop the final image, make it automatically find the correct pixel / unit ratio on the shots so it works with any terrain, I have to skip water reflection renders, and I have not yet poked object LODs. There's still much to do, but it's coming along nice.

I created a new gui element called guiMapDump that is a guiTSCtrl descendant. The resource will probably have to introduce a separate gui for the whole thing. I will try to make it plug&play.

Later on I will also extend the resource to be able to stream these small shots into a bitmap on the screen, so eventually it'd be possible to use cached chunks of images for a new mini map (commander map). This would probably be a lot more faster than rendering the scene again - even if only a few object types are masked in.

I'll post my progress in this thread.