Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5027 closed enhancement (fixed)

Random map SmoothingPainter

Reported by: elexis Owned by: elexis
Priority: Should Have Milestone: Alpha 23
Component: Maps Keywords:
Cc: Patch:


Sometimes it is important to smooth only a subset of the map. For example if when we want a passable paths without touching the surrounding terrain.

We already have the global smoothing function in the heightmap library, so this problem can be solved easily by converting this to painter.

Since there are different algorithms to smoothing an area, this ticket can help with gathering related code.

As of alpha 22 / r21172:

  • The global smoothing heightmap library function accepts an array of vertex locations. It seems unlikely to be reused (especially reused without bugs). Perhaps it would be more relevant to consume an array of points (i.e. Vector2D passed by an area).
  • Pyrennean Sierra does some smoothing by interpolating the height of all vertices of a square with the length of 5 tiles.
  • As recommended by the heightmap library, some maps (island stronghold, schwarzwald) repeat the smoothing process. This might be sufficient to replace both approaches above. But perhaps there is some rare occasion where we need this different smoothing algorithm?

Change History (3)

comment:1 by elexis, 5 years ago

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 21175:

Implement SmoothingPainter for random maps, fixes #5027.

This allows only specific regions of the map to be smoothened, especially important on imported digital elevation models.
It uses the Inverse Distance Weighting / Shepard's method as mentioned by Imarok and formerly implemented in the Pyrenean Sierra map by wraitii in rP12248.

Supersedes the globalSmoothHeightmap function in FeXoRs heightmap library, refs #3764.
Drop the heightmap argument to be consistent with the other painters.
If painting on arbitrary heightmaps is wished, the createArea mechanism, all Placers, Painters, Constraints and Areas can and should support that.

Update the HeightmapPainter from rP21133 to not break if TILE_CENTERED_HEIGHT_MAP is enabled (i.e. numVertices = numTiles), refs #5018.
Use that mode on Mediterranean and Red Sea.
Drop the disabling of bicubic interpolation in the HeightmapPainter instead of extending it to this feature.

Inevitable smoothing performance improvement for Belgian Uplands (from 45 to 15 seconds per call), even if it implies a somewhat different outcome, refs #5011.

comment:2 by elexis, 5 years ago

In 21300:

Ambush bluffs rework.
Remove ugly large circle patterns around the playerbase on Ambush, fixes #4993.
To ensure passability, create ramps from the playerbase to the bluffs.

Change the circular player avoidance to a ChainPlacer generating more heterogenous pattern.
Use vectors in rmgen2 bluffs creation and simplify equations, refs #4992.
Don't turn inaccessible bluffs to plateaus but don't place them until it is certain they are passable.

Increase minimum distance from the playerbase to the mapcenter by picking different distance values per playerbase pattern in g_PlayerbaseTypes.
Attempt to improve bluffs performance by avoiding bluffIgnore by 0 instead of bluff by 12, refs #5011.
Implement AdjacentToAreaConstraint and deleteTerrainEntity.
Delete createBoundingBox and use getBoundingBox, refs #4947, #4805.
Delete fadeToGround and nextToFeature and use conventional createArea calls with the SmoothingPainter of rP21175, refs #5027.
Paint bluff cliffs slightly more accurately using the SlopeConstraint from rP21085, refs #5004.

comment:3 by elexis, 5 years ago

In 21384:

Rework passage creation on Lower Nubia and add map description by Sundiata, refs #5040.

Increase passage size so that elephants and siege engines can pass with higher likelihood.
Use the ElevationBlendingPainter from rP21182, so that the mountain elevation near the river is taken into account.
Smooth the passages even more using the SmoothingPainter, refs #5027.
Add missing SetProgress calls.

Note: See TracTickets for help on using tickets.