Objects Generators
This module brings new type of object to the MapMagic graph - the Objects list. Allows smart placing of objects and terrain trees. Creating complete procedural world with no objects is almost impossible, so Object nodes are here to help with creating your infinite worlds.
Interlink
Connects objects positions with the straight line segments.
Interlink generator operating principle is based on Gabriel graph. It finds the most optimal closest connections between nodes, and, more important, works in a way so no connections are crossing.
Properties
- Iterations: limits the number of passes Interlink takes to link the nodes. If no nodes could be connected in a pass it performs a loop exit, so using excessive values does not affect performance.
- Max Links: limits the maximum number of line connections each node can have. For example, if you want to use only X and T crossroads in a road system made from this spline you should set Max Links to 4 - this will create no more than 4 links per each node.
- Within Tile: enabling this will disregard margin objects (the ones that are placed on tile Margins, out of the active zone), and will link the nodes that are placed only within terrain.
- Clamp (available when Within Tile feature is off): cuts the interlinked lines as they are connected to nodes out of the terrain:
- Off: feature disasbled
- Full: cuts the area within tile Margins
- Active: cuts the area within Active terrain tile.
Optimize
Removes unnecessary spline nodes, trying to preserve the spline shape as much as possible.
This generator could be used to speed up all connected spline nodes.
Some generators subdivide the spline segments, and thus require long segments instead of a serie of the short ones. For example, Pathfinding inds a path between spline nodes, and will work only if the distance between nodes is more than a pathfinding cell. In this cases ioptimized spline can help to get better result.
Optimize generator works in two stage: first it splits the curved segement in a serie of straight short segemnts, and then removes the spline nodes that the nodes that afect the spline shapes as little as possible, up to reaching the deviation value.
Properties
-
Split: the number of straight segments the long curved segment is subdivided. When the value is 1, it will not subdivide the line, and this will only remove already existing nodes. No nodes in new positions will be added, and no nodes will be "moved" to preserve the spline shape in this case.
-
Deviation: the amount o the optimization. When the spline is split, Optimize node evaluates the distance of each node from the line, connecting neighbour nodes. Deviation value - is the minimum distance ratio allowed. If the ratio is lower than the value - the node is removed.
Pathfinding
For each of the line segments - uses the pathfinding algorithms on the terrain heightmap to connect it's start and end. Pathfinding takes into account terrain height and incline, and tries to find a bias between the resulting path total elevation, it's length and it's curvature. Tries to make the line not too long, not too winding and as much flat as possible. If there is a mountain or a in a line's way it will try to get around it. If one of the line's ends is in the mountain it will create a serpentine to make the line not too inclined.
Internally uses A-Star pathfinding algorithm.
Pathfinding will add additional nodes to spline. The nodes density is determined by A-Star grid resolution: for each of the grid cells it will create a new node. Each of the created nodes is placed on the terrain level. Since the A-Star grid is made of square cells, the resulting path bending could be a bit uniform - it will be either strait or will make only 45 or 90 degree tirns. This is usually fixed by applying the Relax generator, that will make a spline lokk more natural.
Pathfinding is one of the slowest spline nodes, so try keepoing it's settings optimized, especially the resolution one.
Inlets:
- Draft: the initial line segments that determine how pathfinding source and destination points. Usually it will be the Interlink segments, but in some cases it could be handy to use Pathfinding on already existing splines - for example, to add some detail to roads.
- Height: the map that determines the terrain height. This re-scaled map will be used as A-Star grid, and each of the cell will estimate it's "value" based on heightmap elevation.
Properties:
- Resolution: the density of the A-Star grid. Determines the precision of the pathfinding algorithm, but at the same time greatly affects it's perfformance
- Distance Factor: determines the role of the p[ath length in a length/incline/curvature bias. If set 0, the spline length doesn't matter, and pathfinding will just try to find most flat and straight line, no matter if it will go through all of the map. The maximum value is not limited, and set relativly to other factors - for example, setting all actors to 1000 will give the same effect as setting them all to 1.
- Elevation Factor: determines the role of the incline elevation in a length/incline/curvature. When set to 0 will not take terrain elevation change into account, and with value increase will try to find more flat path. The maximum value is not limited, and set relativly to other factors.
- Straighten Factor: determines the role of the number of line turns and their sharpness. When set to 0 will not take turns into account, with value increase will try to find more straight lines. The maximum value is not limited, and set relativly to other factors.
- Max Elevation: will count the pixels with this incline (and higher) as impassable. Will not lay the spline on these cells. Note that in some cases there could be no path found (for example, when one of the points is placed on a top of steep peak). The lines with no path found won't be included in the result.
Relax
Smoothens the spline by moving it's node points.
Note that the spline should have plenty of node points to perform a relax. The most common use case for this generator is to smooth the Pathfinding genenerator output.
Properties
- Blur: the amount of smoothness applied to line in each iteration.
-
Iterations: the number of blur iterations. Increasing this number (and lowering the Blur amount at the same time) will give more clean and predictable result, but will increase the generate time.
Relax generator is relatively fast and there's no need to worry about the generate time unless the line is too complicated. But using extremely high values of iterations could be an overkill anyways, and won't differ from less iterated result. Increase this value if you get an unapproprite smoothing in particular cases.
Stamp
Flattens the land along the spline.
The land is always flat perpendicularly the line, and follows the line in it's length. I.e. the land vector, that is orthogonal to the spline in any point, will have the height 0. This makes the Stamp generator a perfect tool for creating roads.
Inlets
-
Spline: the spline that is used as a reference to flatten the land.
-
Height: the source heightmap to be flattened
Properties
- Flat Range: the distance to line that is flat. This value cannot be higher than the Blend Range.
- Blend Range: the overall generator working distance from the line. This includes 100% flat area (Flat Range) and transition between flat range and original height.
Stroke
Outlines the line with 1 (white) on a 0 (black) map.
Typical use case is painting the roads with textures on terrain.
When Hardness is set to 0 Stroke node could be used to determine the distance to line. Returned map value 1 will mean that map pixel is nearly the line, value 0 means that it is on a Width distance or further.
Properties
-
Width: the size of the outlined line, in world units. If the width value is lower than one map pixel size, makes the spline transparent (i.e. setting this pixel "partly filled").
-
Hardness: the percentage of fully filled width compared to the total width. Varies from 0 (only the center pixel has the value of one) to 1 (all pixels within width have the value 1).
WeldClose
Welds closely located segments of two splines, replacing them with a single spline.
Useful to avoid duplicating splines. For example, when building roads it would be unnatural to have two closely located parallel roads - in this case one of the roads will be used. This generator replaces two roads with one.
Properties
- Threshold: the weld distance. Welds splines if the distance between them is lower than Threshold.