Search Unity

How can I make Unity stop adding one row/column to by Terrain heightmap data?

Discussion in 'World Building' started by FreeGameDev, Apr 29, 2018.

  1. FreeGameDev

    FreeGameDev

    Joined:
    Dec 1, 2015
    Posts:
    67
    Hey guys, I have very accurate real world height-map values, and precision is a must for this project. However when I import my 2048x2048 raw height-map data Unity automatically adds a row and column of data so that it becomes 2049x2049 data. (Exporting and a few other tests confirm this is happening.) No matter if I load in the editor or through code using TerrainData.SetHeights(), I get the same result. How do I make the madness stop? The weird thing is that if I import the 2049x2049 raw data, nothing gets added and all works as it should.

    Thanks.
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    this is how it is meant to be. Why are you trying to change this? What exactly do you expect to get from this?

    why would this effect precision? the extra unit added does not contain any data. So your 2048 heightmap will still have 2048 pixels of data.
     
  3. FreeGameDev

    FreeGameDev

    Joined:
    Dec 1, 2015
    Posts:
    67
    It does add data. It actually adds a row and column to the terrain. It is plain as day where the 2 edges go down to 0 elevation. This effects accuracy in that the overall width and height of the data (in meters) is a bit off. For multiple terrains it actually works somewhat in our favor, in that it gives the bridging row/col we need. The overall measurement will still be off by one row/col however.
     
    Last edited: May 1, 2018