将多个纹理应用于相同的网格,如瓷砖

时间:2021-10-13 22:56:27

I've been working on procedural terrain generation in Unity for a while and I was wondering if there was a way to have multiple textures applied to a single mesh like tiles. Imagine a chess board with black and white areas designated on a single mesh and changed during run time. I've considered using multiple meshes but that will over-complicate another part of my program.

我一直在Unity中进行程序地形生成一段时间,我想知道是否有一种方法可以将多个纹理应用于单个网格,如瓷砖。想象一下棋盘,黑色和白色区域在单个网格上指定,并在运行时更改。我考虑过使用多个网格,但这会使我程序的另一部分过于复杂。

1 个解决方案

#1


If you don't want to use submeshes, you can create a custom shader that will reference both textures and switch between them using any logic you desire. Including tiles.

如果您不想使用子网格,可以创建一个自定义着色器,它将引用两个纹理并使用您需要的任何逻辑在它们之间切换。包括瓷砖。

#1


If you don't want to use submeshes, you can create a custom shader that will reference both textures and switch between them using any logic you desire. Including tiles.

如果您不想使用子网格,可以创建一个自定义着色器,它将引用两个纹理并使用您需要的任何逻辑在它们之间切换。包括瓷砖。