I’m making a RPG like Witcher but in the very big location. 10x10km. i made 25 terrains 2x2 km with heightmap 512x512 16bit RAW each. There’s always some fissures between terrains with irregular size.
How can I make this “puzzle” to be looked like seamless?
They need to have tileable heightmap. If map is different, heights for different terrains don’t match and you get a hole.
I made one big HM and cut it to 25 pieces.
i tried to solve this problem in Photoshop but nothing resulted
here is 2 HMs
181410–6449–$images_127.rar (183 KB)
I only know of two ways to make this work: One is to use a mesh instead of a height map and the builtin terrain system, the other is to make sure the edges of all heightmaps are -flat- and preferably have a 100% black or 100% white color.
Have you set up the terrain neighbours correctly? If not, the differing level of detail between adjacent terrains can cause a visible seam.
Read more here:
- Ben
@bigkahuna
probably mesh terrain will lag a lot because it will be very big and it will (must) have threes, bushes, rocks… about 2nd way: there will be no fissures, but a lot of seams, giant seams.
@duck
I saw this but I hadn’t understood how to work with it. I also found this code made by dreamora (sorry if I’m wrong)
using UnityEngine;
using System.Collections;
public class TerrainTiler : MonoBehaviour {
public Terrain[] terrains;
/* Expects an array with 4 entries
* Layed out like:
* 0 1
* 2 3
*/
// Use this for initialization
void Start () {
if( terrains.Length != 4 )
throw new System.Exception("Incorrect number of terrains");
terrains[0].SetNeighbors( null, null, terrains[1], terrains[2] );
terrains[1].SetNeighbors( terrains[0], null, null, terrains[3] );
terrains[2].SetNeighbors( null, terrains[0], terrains[3], null );
terrains[3].SetNeighbors( terrains[2], terrains[1], null, null );
}
// Update is called once per frame
void Update () {
}
}
“terrains[1]” is located in project or hierarchy tab?
“if( terrains.Length != 4 )” 4 is amount of terrains, right?
after I adjust this script I must drag and drop it to terrains in hierarchy tab?
//I’m n00b in codes but I understand something. Unfortunately it’s not enough.
Terrain.SetNeighbours() is probably the issue here. If you don’t set it up correctly, it will give seams.
The script you posted should work when there are exactly 4 terrains. You’d have to assign the script to a GameObject, and then assign the four terrains to the script in the inspector (set the array length to four, then you have four fields, onto which you can drag the terrains).
Is a sample script for multi terrain I provided, thats right ![]()
with more terrains the interlinking will become significantly more complex naturally.
when i’m trying to assign it to game object it shows this window

as the error poitns out the cs script must be named the same as the class in it
Before I forget it: Don’t forget that the heightmaps have specific requirements if you want them to be next to each other on a multi terrain block:
Your main heightmap must be power of 2 + 1 (1025x1025 for example)
out of this you now cut blocks of 513x513, where as the top left pixel is always at a power of 2 position (0x0, 0x512, 512x0, 512x512)
that means that the pixels with coordinate 512 in x or y are part of at least 2 textures (in case of the center, of all 4 actually).
these 4 then can be imported on the 4 terrain blocks and will work seamlessly.
Sounds good. And how to do it in Photoshop? i used slice tool to cut my map in equal parts. in this case it’s different… I if necessary i can make it in another program, just tell me what’s the program and the what to do.
I use photoshop myself.
The slice tool though is of no use in this case as it will always split the image in a “left area” and a “right area” on each border, not a “left + 1 pixel” and a “right” area
All you need to do is get a selection rect of 513x513 pixel size. As it will always align to the border if you move it to it, you can move it into the 4 edges of a 1025x1025 heightmap and you will get 4 correct blocks.
With more than 4, you could position it through the controls. I know that there is a functionality for that, I just commonly can’t remember where in PS
What you mentioned above is not possible at all. You mentioned that you had 5x5 blocks. Thats not possible at all.
heightmaps always must be power of 2 + 1 in their sizes (that are vertex heights for a grid of power of 2 length).
As such a real heightmap, normally power of 2 + 1 itself can only be split into a power of 4 amount of heightmaps (1, 4, 16, 64) by just halfing all existing sides
I’ll try your method…
I generated an abstract-size map(2560x2560) and cut it into 25 parts 512x512 each.
@dreamora Thanks, it worked!
Glad to hear ![]()
As for the hm: ah yeah in that case it worked
I always generate the original heightmaps in power of 2 too, many HM generation application actually don’t even allow anything else (I commonly use L3DT)
me too. after i generated 2^11 heihgtmap i resized it to 2560^2 in photoshop.
Does this procedure still work with 3.3?
I have attempted to use the script above. I do not get any errors. But it is not working as expected.
I have created (by hand) 4 terrains at 1000 X1000 each. I have named them terrain0 -3. I have added them to the array.
When I paint height on them there are seams. According to the scene view, they are not unloading and loading when the char is near.
sorry I was wondering how to extent this array of four tiles into 9,16 etc. I cant see anything in below that determines four entries. Unless it is this first line?
public Terrain[ ] terrains;
/* Expects an array with 4 entries
- Layed out like:
- 0 1
- 2 3
*/
// Use this for initialization
void Start () {
if( terrains.Length != 4 )
throw new System.Exception(“Incorrect number of terrains”);
apriori thanks