Editing Overlapping Terrains
I'm working on a scene that uses two terrain objects: a large terrain used for the landscape (the normal way), and a smaller terrain object that floats on top of the larger terrain. It's used for details, e.g., crop furrows, too small to show in the larger terrain with good performance. The small, furrowed terrain is used for appearance and to place several GameObjects
The scheme works okay when they're both flat, but now we've got to add matching rolling hills to both terrains.
I've come up with two schemes:
Export the heightmaps of both terrains, and edit them in Photoshop, applying the same batch transformation to each heightmap.
Apply the rolling hills to the larger terrain, and on start-up, distort the furrow terrain to match the rolling hills of the larger terrain using a script.
Neither of these seem like a good solution. Has anybody come up with a way of applying the same edits to different, layered terrains?
Answer by getyour411 · Nov 13, 2015 at 12:15 AM
Another way (but very slow) is to sample the source HeightMap heights with GetHeights then feed that to SetHeights on the target terrain within your x,y bounds needed; it will take a long time (loop x, y) for that to work
That's essentially what we ended up doing. We made an editor window to do it, so we can both see what we're getting and not have to worry about it at runtime.
The trick is to remember that terrain height map values are between 0 and 1 and the two terrains may have different scales.
Your answer
![](https://koobas.hobune.stream/wayback/20220612042838im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Terrain "Creating System" consuming infinite memory [Please Help] 0 Answers
Terrain settings resets on changing scene? 1 Answer
unity terrain apply texture by altitude 0 Answers
Why does Terrain.SampleHeight return an extremely low value? 0 Answers
Terrain gets cut off when importing height map, Please help! 0 Answers