L3DT users' wiki
Large 3D terrain generator

 

atEdgeBlender

Plugin information

Author: Aaron
Description A plugin to smoothly blend together two or more heightmaps, smooth seams within a heightmap, or make the north/south and/or east/west edges of a heightmap 'wrap around' smoothly.
Menu options See 'Extensions→atEdgeBlender' in L3DT menu.
Download link atEdgeBlender-bin.zip
Last update v14.04, 15th April 2014
Dependencies L3DT 13.10 or later.

Using atEdgeBlender

Wrap X and Y axes

The 'Extensions→atEdgeBlender→Wrap X and Y axis' menu option will blend the east & west borders and the north & south borders so that they can be wrapped around seamlessly, producing infinitely tiling terrain1). After selecting this menu option, you will be asked to enter a blend depth (see below). This value determines how far, in pixels, the blend region extends from the edges of the affected borders. The default value is whichever is the smaller of 1/4th of the map width, 1/4th of the map height, or 256 pixels. Smaller values will produce sharper transitions from one edge to the other.

Wrap X axis

The 'Extensions→atEdgeBlender→Wrap X axis' menu option will blend the east & west borders so that they can be wrapped around smoothly.

Wrap Y axis

The 'Extensions→atEdgeBlender→Wrap Y axis' menu option will blend the north & south borders so that they can be wrapped around smoothly.

Blend tile edges

The 'Extensions→atEdgeBlender→Blend tile edges' menu option blends the borders of adjacent tiles in a heightmap. This option may be necessary when separate heightmaps have been imported using the merge import option. After selecting this menu option, you will be asked to enter the size of the tiles in X and Y (in pixels), and the blend depth (see below). The blend depth takes the same meaning as with the wrap X and Y axes option described above.

The images below show an example of blending together six random (unrelated) heightmaps to produce a single seamless heightmap:

Before After

Linear regression of tile scaling

Using 'Extensions→atEdgeBlender→Linear regression of tile scaling' is a modification of the blend tile edges option which, in addition to blending the tile borders, also shifts and scales the altitude axis of each tile to minimise any mismatch between adjascent tiles. This feature may be useful when blending together a set of tiles that were imported from images with different altitude scalings, as demonstrated below:

Before After

After you select the menu option, you will be asked to enter the tile size (in pixels), whether you want to blend the tile edges (as with the blend tile edges calculation), and if so, what blend depth you wish to use. The settings window is shown below:

Scripting

The calculation of the edge blending is performed by the calc.HF.BlendEdges extension function, which is available for users via the ZeoScript interface. The arguments of the function are given below. An example of use for this fucntion is given in the box-wrapping script.

The majority of the arguments describe the position and direction of two edges, 'a' and 'b'. Both edges may be placed at arbitrary positions and directions in the map, with no requirement that the edges are parallel (i.e. you can wrap the north edge with the west edge, if you like.)

Argument Type Description
hVar hvar The handle to the heightmap to be blended.
ax0 int The X coordinate of the start of the 'a' edge.
ay0 int The Y coordinate of the start of the 'a' edge.
amode int The direction parallel to the 'a' edge. 0 = west→east, 1 = south→north, 2 = east→west, 3 = north→south.
amode2 int The direction perpendicular (away) from the 'a' edge. 0 = west→east, 1 = south→north, 2 = east→west, 3 = north→south. amode2 must be perpendicular to amode.
adepth int The depth, in pixels, that the blending function will penetrate into the 'a' edge, in the direction given by the amode parameter.
bx0 int The X coordinate of the start of the 'b' edge.
by0 int The Y coordinate of the start of the 'b' edge.
bmode int The direction parallel to the 'b' edge. 0 = west→east, 1 = south→north, 2 = east→west, 3 = north→south.
bmode2 int The direction perpendicular (away) from the 'b' edge. 0 = west→east, 1 = south→north, 2 = east→west, 3 = north→south. bmode2 must be perpendicular to bmode.
bdepth int The depth, in pixels, that the blending function will penetrate into the 'b' edge, in the direction given by the amode parameter.
edgelen int The length, in pixels, of both the 'a' and 'b' edges.
aweight float The relative weighting of the 'a' edge (0→1.0). 0.5 is default, meaning the 'a' and 'b' edges are weighted equally.
Flags uint Reserved for future use.
hOptions hvar Reserved for future use.

Changes

2014/04/14 — Added linear regression of tile scaling function, to re-calculate gain/offset of tiles when vertical scaling is lost in image files.

2013/10/22 — Added fix to allow tile blending to work in X or Y axis only (v13.10.0.0).

2013/03/15 — Page created.

1) Note that L3DT can create seamlessly tiling terrain using the 'Edge wrapping' checkbox in the new map wizards (e.g. in the 'heightfield size' wizard pane.) These options are intended to wrap existing non-mapping heightmaps, such as those from other programs that do not natively support wrapping.
 
plugins/calc/atedgeblender.txt · Last modified: 2017/08/31 07:17 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki