Planetside Software Forums

General => Terragen Discussion => Topic started by: rohitarondekar on April 09, 2009, 09:39:58 PM

Title: Help with ter file format
Post by: rohitarondekar on April 09, 2009, 09:39:58 PM
Hello,
We are working on a small project for our final year - a simple terrain generator written in java.
We wish to be able to export our terrain into the .ter format so that it can be rendered with terragen.

The problem is that we do not know in which range the elevation data is written. Our terrain generator generates height values between some min,max range which is scaled to [0,1]. How do I scale this [0,1] range to save the elevation data and how do I calculate the Baseheight and Heightscale ?

We tried using a hex editor to see how terragen writes these values but we could not establish anything really. Perhaps its a simple conversion but we can't figure it out somehow. Can anybody help with this ?
Title: Re: Help with ter file format
Post by: neuspadrin on April 09, 2009, 10:10:27 PM
I believe you are looking for this:
http://www.planetside.co.uk/terragen/dev/tgterrain.html
Title: Re: Help with ter file format
Post by: rohitarondekar on April 10, 2009, 02:05:21 AM
Yes that specifies the file format. But the problem we are having is with the elevation data. Specifically in which range the elevation data is written. When we export our heightmaps in ter format it opens in terragen with very large height values.
Title: Re: Help with ter file format
Post by: Oshyan on April 10, 2009, 02:10:51 AM
Is this not what you're looking for though (from that page): "The absolute altitude of a particular point (in the same scale as x and y) is equal to BaseHeight + Elevation * HeightScale / 65536. " ?
Title: Re: Help with ter file format
Post by: rohitarondekar on April 10, 2009, 02:41:43 AM
But how do I find the Baseheight and Heightscale ? And also in what range is the Elevation ?