Am I understanding correctly? (Terrain creation)

In docunent, terrain size determination is a little vague.

In heightmap importing section,

To calculate the best heightmap size use patches amount and chunk size to solve this equation: HeightmapSize = NumberOfPatches * ChunkSize + 1 . So if you have square of 4x4 patches, each chunk has 127 size then the heightmap size should be HeightmapSize = 4x4 * 127 + 1 = 509x509 . This non-conventional size is a result of internal engine optimization that packs the patch heightmap into square textures power of two size).

Heightmap size calculation is described as Chunk_size * Number_of_patches+1.
Therefore from following creation
image
Terrain grid should have vertex of 127x127, size of 126x126.

But in tutorial page,
variable meaning vertex count inside a patch is :

var heightMapSize = chunkSize * FlaxEngine.Terrain.PatchEdgeChunksCount + 1;

And PatchEdgeChunksCount is constant variable fixed inside engine, value of 4.
Therefore according to tutorial source, heightmap grid size is multiplied by 4 (about) in contrast to other page of manual.

As I understand, This code means that -
Configuration is [Chunk] < [Patch] < [Terrain]
and a [Patch] must be configured with 4x4 [Chunk]s (constant PatchEdgeChunksCount)
and a [Terrain] has variable 2D array of [Patch]es (configurable in editor).

i.e. I created Chunk size 63, Patch Number 2x2:


Creates 63(Chunk size) x 4(PatchEdgeChunksCount) x 2(Number of Patches) = 504 blocks each side.

And after creation, Property window shows following:
image

But isn’t this need 505x505 heightmap data? This conflicts to manual,
and a little hard to figure how large the resulted size of ‘Create Terrain’ dialog, when user input data…

I use:

int heightMapEdgeLength = terrain.ChunkSize * FlaxEngine.Terrain.PatchEdgeChunksCount + 1;

And always get 509 (so 508m edges) per patch (using the default chunksize of 127). I’m certain that this is correct as I have spent quite some time taking multiple patch terrain apart, messing around with it and putting it back together: I think it is likely I would have had major issues if this was not the case.

It seems to me the quote “HeightmapSize = NumberOfPatches * ChunkSize + 1” from the import section must be incorrect as that assumes a single chunk per patch. And as you said the default is 4x4.

So I would assume that with your 63 size chunk, a patch length for you is 63 * 4 + 1 = 253 vertices, giving a patch edge length of 252 m. So two patches would give 504m… Which I think is where you are? Remember that patch boundary vertices overlap (although they must have the same height value to avoid splits in the terrain). I hope that helps, sorry if I have misunderstood.

Edit:
Just out of interest, are you noticing improved performance with smaller chunks and more patches?