GetAlphamapWeights(TerrainData, TerrainRegion, float, out RectInt)
Gets the weight that an edit of a region applies at each alphamap texel it covers.
Read time 1 minuteLast updated 22 days ago
Definition
- Type: Method
- Namespace: UnityEditor.TerrainTools
- Assembly: UnityEditor
GetAlphamapWeights(TerrainData, TerrainRegion, float, RectInt)
public static float[,] GetAlphamapWeights(TerrainData terrainData, TerrainRegion region, float falloff, out RectInt texelRect)
Parameters
The TerrainData whose alphamap grid to use.
The region.
The fraction of the region, from 0 to 1, over which the weight fades at its edge. See TerrainRegion.GetWeight.
The rectangle of alphamap texels that the weights cover.
Returns
Type | Description |
|---|---|
| float[,] | The weights, from 0 to 1, indexed [z, x] from the corner of |
Remarks
These are the weights that TerrainEditUtility.PaintLayers applies with the same falloff: the region is widened to the alphamap texels it crosses in the same way, and texel (x, z) lies at (x, z) * size / (alphamapResolution - 1). A texel with a weight of 0 lies outside the region. Read the layer weights of the same rectangle with TerrainData.GetAlphamaps.