Unity Terrain from .RAW - Still needed +1 in Size?

hi there,

I wonder, if Unity 3.5.7 must have a heightmap with a power of two +1 resolution, when
want to create a terrain from it?

Sometimes there are references, that state “+1” - sometimes, the map resolution is 1024x1024 for example…

So, what is it all about the “+1” for size/resolution?

-cheers

Heightmaps must alway be 1 pixel larger than the resolution of the terrain texture in every dimension. This is true in every version of Unity and, generally, in every terrain modelling program, because each pixel from the texture must be mapped to a polygon (consisting of two triangles), not a pixel, in the terrain mesh.

Suppose you had a 2x2 texture (each pixel in the texture represented by an “X”):

  X   X

  X   X

To map those pixels onto polygons you would need a terrain like this (each pixel in the terrain heightmap represented by “+”). Notice it requires a 3x3 grid to accomodate the 2x2 texture?

+---+---+
| X | X |
+---+---+
| X | X |
+---+---+

In fact, each of those “square” polygons are actually composed of two triangles, so:

  • 65x65 Heightmap resolution = 8,192 Terrain polygons
  • 129x129 Heightmap resolution = 32,768 Polygons
  • 257x257 Heightmap resolution = 131,072 polygons

Thanks a lot tanoshimi - I just got under “15 reputation”, so I can vote.