Version: 2020.2
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

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961