Adding a Multi file export vector map node

This node exports a vector map as several image files from a terrain or a terrain composition linked to a Compute vector map node.

The advantage of exporting multiple files is to optimize the rendering times for very large vector maps in an external engine where it is more practical to manage parts of the vector map in different files.

To add a node, right-click in the Graph Editor and select Create Node  > Export  > Multi file export vector map.

Double click on the node to open its parameters:

Exporting a vector map to multiple files

To export a vector map to multiple files, set the following parameters:

  • File pattern: This is the formula used to name the files to export. The naming convention is important because the node aligns the vector map on a grid and where the first number is the X axis and the second one is the Y axis. Depending on the XY coordinates of the part of the vector map and the number of files to export, each exported file be named according to its XY coordinates, for example the top left part of a 2x2 vector map will have the name Group_0_0.png, the top right part Group_0_1.png, etc.

See Explanation about the formula for a detailed description about the formula.

Browse to the folder where want to save your files and copy the path.

In File pattern in the parameters dialog, paste the path and add a file name, for example here we add "Group" and then _$x_$y, where $x represents the position of the part of the normal map on the X axis and $y represents the Y axis.

The following pattern works for exporting to UE4: "filename_X$x_Y$y.jpg" (UE4 requires an "X" and an "Y" before the coordinates of the tile).

  • File format: Choose the file format from the options available.
  • Size of each file: Set the following parameters:
  • Width and height: Set the width and height in number of vertices.
  • Overlapping: Instant Terra displays the number of files to create based on this parameter.
    If overlapping is set to 0 the file is cut into parts, and the parts have nothing in common.
    If overlapping is set to 1, two contiguous parts will have a column or a line in common.
    If overlapping is set to 2, two contiguous parts will have 2 columns or 2 lines in common.

The width, height and overlapping can be driven by calculation nodes linked to the optional connectors. In the example below, the width of the export is controlled by a constant value of 40. See Optional connectors for more details.

  • Number of files: The number of files to export depends on the graph and the value of the overlapping parameter. This parameter is non-editable.
  • Click Export now to export the files.

A pop-up dialog displays the progress of the export.

Another popup-up dialog confirms the export.

The files are exported to the directory entered in the File pattern box.

Explanation about the formula

For the imported files, the node:

  • Replaces $y by 0, and finds the largest value of $x that exists for the files, i.e. input_$x_0.bmp. This determines one dimension of the grid of files, called X.
  • Replaces $x by 0, and finds the largest value of $y that exists for the files, i.e. input_0_$y.bmp. This determines the other dimension of the grid of files, called Y.
  • The node iterates on $y and $x and calculates the image size, i.e. width and height.

Each file is loaded, and forms the corresponding part of the final vector map.

The replacement rules in the file names (or directory) are:

  • $x is replaced by: 0, 1, ..., 10, 11, ...
  • $0x is replaced by: 00, 01, ..., 10, 11, ..., 100, ...
  • $00x is replaced by: 000, 001,..., 010, 011,..., 100,...
  • $000x is replaced by: 0000, 0001,..., 0010, 0011,..., 0100,..., 1000
  • $0000x is replaced by: 00000, 00001,..., 00010, 00011,..., 00100,..., 01000,..., 10000,...
  • $00000x is replaced by: 000000, 000001,..., 000010, 000011,..., 000100,..., 001000,...
  • Ditto for $y, $0y, $00y, $000y, $0000y, and $00000y.
  • The expressions above can be used:
    • In the name of the file and in the directory name.
    • In one or more copies.
    • Mixed (for both $X and $Y).

For example:

Expression Product names
vector map/$0x/$0y/file.bmp vector map/00/00/file.bmp
vector map/01/00/file.bmp
vector map/10/24/file.bmp
vector map/$0x/$0y/file_$x_$y.bmp vector map/00/00/file_0_0.bmp
vector map/01/00/file_1_0.bmp
vector map/10/24/file_10_24.bmp

Parameters

Parameter Use
File pattern Name and directory of the files to export
File format Format of the files to export
Width and height Sets the width and height of each file to export
Overlapping Sets the number of rows or columns to overlap
Number of files Non-editable parameter displaying the number of files to export depending on the graph and overlapping

Copyright © 2022 · All Rights Reserved · Wysilab