PDA

View Full Version : HGT-Converter release



alpaca
10-05-2005, 15:01
Ok, this is the first version of my HGT-Converter.
It takes .tga image files and converts them to .hgt files and vice-versa.

You will need a JRE 1.50 or higher to use it, which can be found here:
http://www.java.com/en/download/manual.jsp

This is the release file, you'll find more detailed info inside:
http://www.totalwar.org/Downloads/Rtw_Uploads/RTWupload/HGT_Converter.zip

Oh, and please post what you think about the height-calculation. I'd like to know if my formula is ok.

A screen:
https://img267.imageshack.us/img267/4581/crimealakescreen0va.jpg

Monkwarrior
10-05-2005, 15:37
Is there any method to test the map other than including it in BI? Can it be tested in RTW 1.2?

I've just downloaded the tool and generated a map_heights.hgt. From a tga of 453 KB I've obtained a hgt of 392 KB. Does it seem correct?

Anyway, if this tool works properly, I will propose to the TotalWar modders community to build a shrine in your honour. ~:cheers:

alpaca
10-05-2005, 15:48
Hmm this seems to be too small.
The hgt uses 32 bpp so it should be a third larger than the tga.
Can you upload the image and send me a link so I can do some tests with it?

And I don't know if it can be used in 1.2 because I don't have that version anymore ;)

Myrddraal
10-05-2005, 15:56
This is good news, very good :smile:

For the time being this should be in Mod Discussion

When you've smoothed out the problems I'll shift it to the Scriptorium so that it doesn't get lost in the abyss of page 2

Centurion Cato
10-05-2005, 18:52
Ok here are my results using this tool.

https://img380.imageshack.us/img380/5373/mm1dl.jpg

My .hgt file is twice as big as the tga file, is that right?

Anyway i'll continue with my map, thanks! :)

blindfaithnogod
10-05-2005, 22:39
great job! i tried it, the heights seem good to me. thanks!

edit: heres a look to prove it works
https://img260.imageshack.us/img260/714/map3gt.th.jpg (https://img260.imageshack.us/my.php?image=map3gt.jpg)

alpaca
10-05-2005, 23:51
Ok here are my results using this tool.


My .hgt file is twice as big as the tga file, is that right?

Anyway i'll continue with my map, thanks! :)

Hum it's a little strange, but if you fully checked the map and it's all right...

In fact, the R:TW tga uses 24 bpp while the height-information is stored in 32-bit numerical values, so theoretically speaking the hgt file should be 4/3 the size of the tga file.
And my program reads every pixel for itself and then instantly writes the height info into the file (I'm not running another algorithm on the data later) so it shouldn't be able to produce any other information.
Unfortunately I forgot to include a check that the image has to be 24 bpp, so the program accepts pretty much anything, but it will most probably convert most of the map to water if the image file isn't supplied as 24-bit.
If you don't mind, I'd like to be sent your image file, by PM or maybe by email. Or you can upload it somewhere and just post a link.
If you want to send it by email, just drop me a PM and I'll send you my adress.

Oh, and as a little note about the heights:
I think I already stated in the that I am using a mathematical formula to calculate the height-information, and this is it. CA seems to have used some algorithm after calculating heights from the image file that evened out the whole thing somewhat.
I made the formula with some testing, until it delivered satisfying results. If anyone's interested in it, here goes:
21.17x - 0.05 * (x - 120)^2 + 1.0313^x + 720 = y (x is the blue-value, y is the height; this formula is only applied to tiles where all three color-values are the same, everything else is water)
This is a little complex for non-mathematicians but basically it boosts the medium ranges a little and then steepens mountains, which is why the greek mountains you see below (taken from Imperium: TW which Atheist Peace got to work in BI now) look really spiffy, and also ensures that total black (0 0 0) is represented as a height of 1.
https://img335.imageshack.us/img335/2507/bimapworking13zq.jpg

Monkwarrior
10-06-2005, 08:37
@alpaca
You were right about the size (my mistake).
From a tga of 453 KB the hgt was 603 KB (exactly 4/3).
I will check it in BI when I "translate" all the other text files to the "new language".

Thanks a lot.~:cheers: