- Home /
Copying sections of terrain textures
So I have a collection of terrain prefabs that I randomly place throughout a larger base terrain to create a random assortment of geological features. I want to make sure that some of those prefabs match the terrain they go on top of exactly, but I'm running into some issues copying and pasting segments of my base terrain's splat map. Here's the relevant code snippet:
curTerrain.terrainData.splatPrototypes=baseMap.terrainData.splatPrototypes;
curTerrain.terrainData.detailPrototypes=baseMap.terrainData.detailPrototypes;
curTerrain.terrainData.RefreshPrototypes();
curTerrain.terrainData.SetAlphamaps(0,
0,
baseMap.terrainData.GetAlphamaps((int)curTerrain.transform.position.x,
(int)curTerrain.transform.position.z,
Mathf.RoundToInt(baseMap.terrainData.alphamapWidth),
Mathf.RoundToInt(baseMap.terrainData.alphamapHeight)));
I keep getting an error, however, saying that my texture rectangle doesn't match the bounds. I know that I can fix this by changing the control texture resolution on my terrain, but because I'm wanting to grab the global position of the baseMap's splatmap and put it onto the local curTerrain splatmap, I'd have to make my curTerrain control resolution bigger than the actual terrain. Is there a simpler way to achieve this?
Your answer
Follow this Question
Related Questions
Terrain Textures (via Splat) 0 Answers
How to get rid of terrain splatmap texture seams? 1 Answer
Terrain Being Buggy 0 Answers
Can't paint more than 8 textures on terrain 3 Answers
Splat Map with transition texture? 0 Answers