use case: settlements or "big" objects placement
Add a function to flatten a heightmap locally around a set of points.
Proposed behavior
Given:
- a heightmap
- a set of
(x, y) points
- an optional per-point radius scaling factor
r
- an influence radius
ir in pixels
the function modifies the elevation around each point toward a reference elevation.
Reference elevation
The reference elevation should be configurable:
POINT — elevation at the point
MEAN — average elevation within ir around the point
MIN — minimum elevation
MAX — maximum elevation
- potentially other statistics later (median, percentile, etc.)
Radial flattening
Instead of explicitly interpolating with lerp, the flattening amount should be determined from the normalized radial distance to the point and the radial functions already available in HighMap.
For a pixel at distance d from the point:
u = d / radius
A radial function f(u) determines the flattening profile, with u = 0 at the center and u = 1 at the influence boundary.
The resulting elevation can then be expressed conceptually as:
h' = h + strength * f(u) * (h_ref - h)
where:
h is the current elevation
h_ref is the reference elevation
strength controls the overall flattening intensity
f controls the spatial shape of the flattening
The existing radial functions should be reused rather than introducing a new falloff implementation.
The effective radius is:
radius = ir * r
with r = 1 by default.
Shape and strength
The API should expose both:
strength — how strongly the terrain is flattened toward the reference elevation
shape / radial-function parameters — how the flattening is distributed spatially
This separates how much the terrain is modified from how the modification is shaped.
Overlapping points
The behavior for overlapping influence areas should be deterministic and explicitly defined.
Possible approaches include combining the individual influence weights and reference elevations, or applying the strongest influence. A weighted combination is likely preferable to sequentially processing the points, as it avoids order-dependent results.
Possible extensions
- Inner radius with full flattening and an outer falloff radius.
- Anisotropic/elliptical influence regions if needed later.
- Per-point
strength, radius, and shape parameters rather than only global values.
use case: settlements or "big" objects placement
Add a function to flatten a heightmap locally around a set of points.
Proposed behavior
Given:
(x, y)pointsririn pixelsthe function modifies the elevation around each point toward a reference elevation.
Reference elevation
The reference elevation should be configurable:
POINT— elevation at the pointMEAN— average elevation withiniraround the pointMIN— minimum elevationMAX— maximum elevationRadial flattening
Instead of explicitly interpolating with
lerp, the flattening amount should be determined from the normalized radial distance to the point and the radial functions already available in HighMap.For a pixel at distance
dfrom the point:u = d / radiusA radial function
f(u)determines the flattening profile, withu = 0at the center andu = 1at the influence boundary.The resulting elevation can then be expressed conceptually as:
h' = h + strength * f(u) * (h_ref - h)where:
his the current elevationh_refis the reference elevationstrengthcontrols the overall flattening intensityfcontrols the spatial shape of the flatteningThe existing radial functions should be reused rather than introducing a new falloff implementation.
The effective radius is:
radius = ir * rwith
r = 1by default.Shape and strength
The API should expose both:
strength— how strongly the terrain is flattened toward the reference elevationshape/ radial-function parameters — how the flattening is distributed spatiallyThis separates how much the terrain is modified from how the modification is shaped.
Overlapping points
The behavior for overlapping influence areas should be deterministic and explicitly defined.
Possible approaches include combining the individual influence weights and reference elevations, or applying the strongest influence. A weighted combination is likely preferable to sequentially processing the points, as it avoids order-dependent results.
Possible extensions
strength,radius, and shape parameters rather than only global values.