Experimental: this API is experimental and might be changed or removed in the future.

TerrainPaintUtility.CollectNormals

切换到手册
public static Experimental.TerrainAPI.PaintContext CollectNormals (Terrain terrain, Rect boundsInTerrainSpace, int extraBorderPixels);

参数

terrain参考地形区块。
boundsInTerrainSpace要从中收集法线的地形空间区域。
extraBorderPixels所需的额外边框像素数量。

返回

PaintContext 包含指定区域的组合法线贴图数据的 PaintContext。

描述

Helper 函数,用于设置 PaintContext 以收集一个或多个地形区块中的网格法线数据。

CollectNormals 标识位于边界矩形的 extraBorderPixels 中的所有法线贴图像素。 将在相邻的连接地形区块中搜索。 像素被收集到临时渲染纹理中并存储在 PaintContext.sourceRenderTexture 中。

重要信息:没有相应的函数可以将修改后的法线贴图数据写回到地形区块,因为法线贴图不会被存储;法线贴图是根据高度贴图计算出的。

在使用完 sourceRenderTexture 之后,必须调用 TerrainPaintUtility.ReleaseContextResources 来释放 RenderTexture 资源。

另请参阅:PaintContext.GatherNormalsPaintContext