我遵循了Sebastian Lague在Link to tutorial上的可爱的教程。我把它应用到我自己的场景中,我想要生成陆地,最终得到了一个很酷的结果:

正如你在图像中看到的,有一个网格,这是一个简单的纹理,重复(平铺)x次,并应用于生成的网格。它的代码如下所示:
Vector2[] uvs = new Vector2[vertices.Count];
for (int i = 0; i < vertices.Count; i++)
{
float percentX = Mathf.InverseLerp(-map.GetLength(0) / 2 * squareSize, map.GetLength(0) / 2 * squareSize, vertices[i].x) * tileAmount;
float percentY = Mathf.InverseLerp(-map.GetLength(0) / 2 * squareSize, map.GetLength(0) / 2 * squareSize, vertices[i].z) * tileAmount;
uvs[i] = new Vector2(percentX, percentY);
}
mesh.uv = uvs;我想知道,在这个过程中,是否有任何方法可以在此脚本中或使用着色器将每个瓷砖着色为不同的阴影。
发布于 2019-11-26 12:47:24
它们将自动插值以获得平滑的渐变。如果你不想这样,你必须构建网格,使每个正方形都有单独的顶点,而不是与相邻的正方形共享。
https://stackoverflow.com/questions/59017971
复制相似问题