Allows to import custom heightmaps from textures or RAW files.
Custom heightmaps could be used to create a base terrain, which then could be detailed with noise, erosion and other nodes:
Or it could be used to create custom stamps with the Stamp node.
Imported Map asset
Import node does not load RAW file or texture directly - it's a costly operation that greatly increases the graph size. Instead a special asset is used to load and keep (serialize) RAW or texture data. This asset is called Imported Map. The graph itself (import node) only keeps the reference to this asset.
You can experience some lag when large Imported Map is selected in inspector. This lag is caused by Unity trying to serialize the imported map each frame, and will go out on de-selecting Imported Map.
To create Imported Map use the standard way assets are created: Assets (or right-click in project view) -> Create -> MapMagic -> Imported Map.
Map Source: determines whether the imported map is loaded from RAW file or texture.
Load Raw (for raw mode): opens the dialog to load the .raw file.
In order to use it the .raw file should be properly prepared. It should be:
- square (width should be equal to length)
- 16 bits per channel
- and it should be saved as .raw file with PC byte order
Placing RAW file in the assets folder is not required, it could be loaded from any location.
Texture slot (for texture mode): field for the texture asset that is used as the map source. The source texture should be placed inside the Assets folder and should have Read/Write attribute enabled in texture settings.
Channel (for texture mode): Selects the channel to be used as map source:
- Average: the average of 3 channels (red, green and blue)
- Grayscale: the map value is calculated using formula:
0.21*R + 0.72*G + 0.07f*B
- Red/Green/Blue: uses only one color channel
- Alpha: using texture alpha
Reload button: reloads map from previously assigned texture or RAW file.
- Map: imported map asset slot
- Wrap Mode: determines how the heightmap should be repeated so that every terrain point will not miss a map:
Scale: sets the size of heightmap. By default size is equal to one chunk (terrain).
Scale (4 terrain grid): 0.5, 1, 2
Offset: moves figure along X or Z-axis (in world units).
Offset (4 terrain grid): 0, 500, 1000