元编程参考文档

高度图选择器

14 个节点

本页内容 14

环境光遮蔽用途标记

函数

Usage of an ambient occlusion (sky visibility) field.

签名
环境光遮蔽用途标记() -> 文本
string HeightmapDataUsageTokenAmbientOcclusion()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

坡向(度)用途标记

函数

Usage of an aspect field, in compass degrees.

签名
坡向(度)用途标记() -> 文本
string HeightmapDataUsageTokenAspectDegrees()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

凸度用途标记

函数

Usage of a raw convexity field, in metres above the local mean.

签名
凸度用途标记() -> 文本
string HeightmapDataUsageTokenConvexity()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

曲率用途标记

函数

Usage of a raw curvature field, in 1/metre.

签名
曲率用途标记() -> 文本
string HeightmapDataUsageTokenCurvature()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

距离用途标记

函数

Usage of a distance field, in metres.

签名
距离用途标记() -> 文本
string HeightmapDataUsageTokenDistance()

返回

结果文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

计算环境光遮蔽

函数

Measures how much of the sky each cell sees, by marching the horizon in several directions: 1 in the open, darker in valleys, gorges and at the foot of cliffs.

签名
计算环境光遮蔽 -> Scalar Field
    源: Scalar Field
    半径(米): 数字
    方向数: 整数
    步数: 整数
    强度: 数字
ScalarField2D CalculateAmbientOcclusion(
    ScalarField2D source,
    double radiusMetres = 300,
    int directions = 16,
    int steps = 16,
    double strength = 1)

参数

名称类型默认值说明
源Scalar Field—Heightmap in metres.
半径(米)数字300How far in metres to look for occluders; larger lets whole mountains shade a valley.
方向数整数16Number of horizon directions (8 to 32).
步数整数16Samples per direction (8 to 32), spaced geometrically so near ground is sampled densely.
强度数字1Scales the darkening: 1 is physical, above 1 deepens it.

返回

结果Scalar Field

备注

For each direction, samples at geometrically spaced distances (from one cell out to Radius Metres) find the highest elevation angle θ of the horizon; the visibility is 1 − mean(sin θ). The result drives dirt, moss and darkening; invert it for a cavity mask. Beyond the map border the edge cells are taken to continue outward. Cost grows with directions × steps.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

计算坡向(度)

函数

Gives the compass direction each slope faces (its downhill direction), in degrees clockwise from north.

签名
计算坡向(度)(源: Scalar Field, Y 轴朝北: 真否) -> Scalar Field
ScalarField2D CalculateAspectDegrees(
    ScalarField2D source,
    bool heightmapYPointsNorth = true)

参数

名称类型默认值说明
源Scalar Field—Heightmap in metres.
Y 轴朝北真否TrueTrue when increasing row index points north; false for north-up images.

返回

结果Scalar Field

备注

0 faces north, 90 east, 180 south, 270 west; flat cells, which face nowhere, read -1. East is +X (increasing column). By default north is +Y (increasing row), the convention ToHillshade and BakeShadowMap use, so a slope whose aspect equals a hillshade's azimuth is the one that hillshade lights; for an ordinary north-up raster image, where row 0 is the northern edge, set Heightmap Y Points North to false.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

计算凸度

函数

Measures how far each cell stands above (positive) or below (negative) the Gaussian-weighted mean height around it, in metres.

签名
计算凸度(源: Scalar Field, 半径(米): 数字) -> Scalar Field
ScalarField2D CalculateConvexity(
    ScalarField2D source,
    double radiusMetres = 50)

参数

名称类型默认值说明
源Scalar Field—Heightmap in metres.
半径(米)数字50Standard deviation in metres of the neighbourhood the height is compared with; it sets the size of feature selected.

返回

结果Scalar Field

备注

This is the difference between the height and a blur of it, the classic convexity selector: crests, ridges and knobs come out positive, gullies, channels and valley floors negative. Unlike curvature it needs no differentiation, so it is robust on quantised imports.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

计算曲率

函数

Measures the surface curvature of a heightmap in 1/metre, positive on convex ground and negative on concave ground.

签名
计算曲率 -> Scalar Field
    源: Scalar Field
    类型: Terrain Curvature Type
    尺度(米): 数字
ScalarField2D CalculateCurvature(
    ScalarField2D source,
    TerrainCurvatureType type = TerrainCurvatureType.Mean,
    double scaleMetres = 20)

参数

名称类型默认值说明
源Scalar Field—Heightmap in metres.
类型Terrain Curvature Type平均Profile (down the slope), Plan (across it) or Mean.
尺度(米)数字20Standard deviation in metres of a Gaussian applied before differentiating; 0 uses the raw cells.

返回

结果Scalar Field

备注

Second derivatives come from the 3×3 neighbourhood (Evans–Young / Zevenbergen–Thorne) with the cell size in metres. Imported heightmaps are quantised (a 16-bit file over 2.6 km of relief steps in 4 cm), and second derivatives amplify that into noise, so smooth first: Scale Metres sets the size of landform the curvature describes, from rocks (a few metres) to whole ridges (hundreds). Profile and plan curvature are undefined on perfectly flat ground and read 0 there.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

计算距离

函数

Measures the exact straight-line distance in metres from every cell to the nearest cell of a mask.

签名
计算距离 -> Scalar Field
    蒙版: Scalar Field
    阈值: 数字
    有符号: 真否
ScalarField2D CalculateDistance(
    ScalarField2D mask,
    double threshold = 0.5,
    bool signed = false)

参数

名称类型默认值说明
蒙版Scalar Field—Mask to measure from, such as water, roads or rock.
阈值数字0.5Value at or above which a cell belongs to the mask.
有符号真否FalseIf true, distances inside the mask are negative distances to its edge.

返回

结果Scalar Field

备注

Cells at or above Threshold belong to the mask. The transform is exact Euclidean (Felzenszwalb–Huttenlocher), so distances grow in circles, not diamonds or octagons. Unsigned, mask cells read 0 and the cells beside them one cell width (distances run between cell centres). Signed, the mask's inside is negative and both sides are measured from the boundary halfway between cells, so the field is continuous across it. With no mask cells at all, every cell reads the map's diagonal.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

按坡向选择

函数

Selects slopes facing a compass direction: a 0..1 mask, for north-facing snow, sun-facing dry grass, moss on shaded sides.

签名
按坡向选择 -> Scalar Field
    源: Scalar Field
    朝向(度): 数字
    扇区半宽(度): 数字
    衰减(度): 数字
    最小坡度(度): 数字
    坡度衰减(度): 数字
    Y 轴朝北: 真否
ScalarField2D SelectAspect(
    ScalarField2D source,
    double headingDegrees = 0,
    double spreadDegrees = 45,
    double falloffDegrees = 30,
    double minSlopeDegrees = 3,
    double slopeFalloffDegrees = 5,
    bool heightmapYPointsNorth = true)

参数

名称类型默认值说明
源Scalar Field—Heightmap in metres.
朝向(度)数字0Direction the selected slopes face, degrees clockwise from north.
扇区半宽(度)数字45Half-width in degrees of the fully selected sector.
衰减(度)数字30Degrees beyond the spread over which the mask fades to 0.
最小坡度(度)数字3Steepness in degrees below which ground counts as flat and is not selected.
坡度衰减(度)数字5Degrees above the minimum slope over which the selection fades in.
Y 轴朝北真否TrueTrue when increasing row index points north; false for north-up images.

返回

结果Scalar Field

备注

A slope scores 1 when its aspect is within Spread Degrees of the heading, fading to 0 over a further Falloff Degrees. Flat ground has no meaningful aspect, so the score is also faded in with steepness, from Min Slope Degrees over Slope Falloff Degrees. See HeightmapSelectors.CalculateAspectDegrees for the axis convention.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

按凸度选择

函数

Selects ridges or gullies by convexity: a 0..1 mask that lights crests and darkens channels (Signed), or keeps one side only.

签名
按凸度选择 -> Scalar Field
    源: Scalar Field
    半径(米): 数字
    极性: Heightmap Selector Polarity
    对比度: 数字
    参考高度(米): 数字
ScalarField2D SelectConvexity(
    ScalarField2D source,
    double radiusMetres = 50,
    HeightmapSelectorPolarity polarity = HeightmapSelectorPolarity.Signed,
    double contrast = 1,
    double referenceMetres = 0)

参数

名称类型默认值说明
源Scalar Field—Heightmap in metres.
半径(米)数字50Size of feature to respond to: standard deviation in metres of the neighbourhood.
极性Heightmap Selector Polarity双向Convex, Concave, or Signed (0.5 is neither).
对比度数字1Multiplier before saturation; higher makes the mask harder.
参考高度(米)数字0Height above the local mean that maps to tanh(1) ≈ 0.76; 0 picks it from the field.

返回

结果Scalar Field

备注

The convexity (metres above the local mean) is divided by a reference height and passed through tanh. With the reference left at 0 it is the field's own 90th percentile of |convexity|; give it in metres (e.g. 5) when separate tiles must agree.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

按曲率选择

函数

Selects convex or concave ground by its curvature: a 0..1 mask.

签名
按曲率选择 -> Scalar Field
    源: Scalar Field
    类型: Terrain Curvature Type
    尺度(米): 数字
    极性: Heightmap Selector Polarity
    对比度: 数字
    参考曲率: 数字
ScalarField2D SelectCurvature(
    ScalarField2D source,
    TerrainCurvatureType type = TerrainCurvatureType.Mean,
    double scaleMetres = 20,
    HeightmapSelectorPolarity polarity = HeightmapSelectorPolarity.Convex,
    double contrast = 1,
    double referenceCurvature = 0)

参数

名称类型默认值说明
源Scalar Field—Heightmap in metres.
类型Terrain Curvature Type平均Profile, Plan or Mean curvature.
尺度(米)数字20Size of landform to respond to: standard deviation in metres of the smoothing applied first.
极性Heightmap Selector Polarity凸Convex, Concave, or Signed (0.5 is flat).
对比度数字1Multiplier before saturation; higher makes the mask harder and wider.
参考曲率数字0Curvature in 1/metre that maps to tanh(1) ≈ 0.76 (Convex/Concave); 0 picks it from the field.

返回

结果Scalar Field

备注

The curvature is divided by a reference curvature and passed through tanh, so the mask saturates smoothly instead of clipping. With the reference left at 0 it is the field's own 90th percentile of |curvature|, which adapts to any terrain but differs between tiles; give an explicit reference (in 1/metre, e.g. 0.002 for a 500 m bending radius) when tiles must match.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成

按距离带选择

函数

Selects a band of ground at a distance range from a mask: shore strips beside water, riverbank sediment, verges along roads, scree aprons below rock.

签名
按距离带选择 -> Scalar Field
    蒙版: Scalar Field
    最小距离(米): 数字
    最大距离(米): 数字
    衰减(米): 数字
    阈值: 数字
ScalarField2D SelectDistanceBand(
    ScalarField2D mask,
    double minMetres = 0,
    double maxMetres = 30,
    double falloffMetres = 10,
    double threshold = 0.5)

参数

名称类型默认值说明
蒙版Scalar Field—Mask to measure from.
最小距离(米)数字0Inner edge of the band, metres from the mask.
最大距离(米)数字30Outer edge of the band, metres from the mask.
衰减(米)数字10Width in metres of the fade on each side.
阈值数字0.5Value at or above which a cell belongs to the mask.

返回

结果Scalar Field

备注

Built on HeightmapSelectors.CalculateDistance. The band is fully selected between Min Metres and Max Metres from the mask and fades over Falloff Metres on each side; with a minimum of 0 the mask itself is included and only the outer edge fades.

所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图选择器
所属包
程序化生成