Meliora Islands Terrain Deformation
Since the game is set on an island and buildings can be placed freely, the terrain needs to be flat to avoid floating or clipping buildings.
Due to shaders and generation tools, the main requirement was to deform Unity Terrain. No custom meshes.
terrainData.SetHeightsDelayLOD(posX, posY, currentHeights);
This method is used to set a 2D array at a specific position on the height map. In essence, this only changes small parts of the heightmap.
'terrainData.SyncHeightmap();' updates the actual terrain and details like grass but also costs the most CPU.
All that had to be done now, was to create a stencil object that can be placed anywhere on the terrain and change its height.
The only change that had to be made was smoothing the edges. Since every building would have a different foundation, a texture was used to smooth terrain differently.
As seen in the next image, a 2d AABB is created for the stencil to effect the correct area on the terrain's heightmap.
Since the main island's terrain is very big, the results were not always perfect.
Ultimately, this feature was not used due to a third party package not working like we wanted.