I’m using Unity Editor version 2021.3.21f1, HDRP with Unity’s Terrain.
So I stumbled upon an issue I don’t know how to resolve. I’ve been trying to create a world-generator and placing grass through code seems to give me worse results as using unity’s paint brush tools.
The results above are consistent along all detail resolutions, the brush (left side) always places a tad more grass then my script (right side) which is weird to me.
Here’s the code to place grass on every single position for two grass types:
int detailRes = terrain.terrainData.detailResolution;
int[,] detailMap = new int[detailRes, detailRes];
int[,] detailMap2 = new int[detailRes, detailRes];
for(int i = 0; i < detailRes; i++)
{
for(int j = 0; j < detailRes; j++)
{
detailMap[i, j] = 1;
detailMap2[i, j] = 1;
}
}
terrain.terrainData.SetDetailLayer(0, 0, 0, detailMap);
terrain.terrainData.SetDetailLayer(0, 0, 1, detailMap2);
I don’t know whether this is on me or the brush just works better, I couldn’t really find much documentation on this nor people talking about it through a quick google and forum search. Does anybody have experience with this?
edit: I realized that you can write code snippets instead of showing images of the code.