Hi guys, I’m having a bit of an issue here and have spent days trying different things but nothing seems to work. I have done extensive goggling and nothing has come up. Maybe somebody has run into this problem and wants to share some light on this matter? Thanks in advance for your help.
Please note that the terrains are exactly the same with the exception of the first row and column. The perspective screen shots distorts the second terrain a little
private void GetHeights(){
heights = new float[65536];
for(int i=0; i<heights.Length; i++)
heights[i] = i / 65536.0f;
}
... Relevant Code
if(heights == null)
GetHeights();
using (System.IO.FileStream f = System.IO.File.OpenRead(heighmapFile)) {
using (System.IO.BinaryReader br = new System.IO.BinaryReader(f)) {
res = Mathf.CeilToInt (Mathf.Sqrt (f.Length / 2));
tdata.heightmapResolution = res + 1;
tdata.size = new Vector3 (res, res / 3, res);
tdata.baseMapResolution = res;
tdata.SetDetailResolution (res, 8);
float[,] heightData = new float[res,res];
for (int x=0; x<res; x++) {
for (int y=0; y<res; y++) {
heightData [x, y] = heights[br.ReadUInt16()];
}
}
tdata.SetHeights (0, 0, heightData);
}
}