Help with ter file format

Started by rohitarondekar, April 09, 2009, 09:39:58 PM

Previous topic - Next topic

rohitarondekar

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 ?

neuspadrin


rohitarondekar

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.

Oshyan

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. " ?

rohitarondekar

But how do I find the Baseheight and Heightscale ? And also in what range is the Elevation ?