Adding a Multi file export mask node

This node exports several files from a mask. The images are exported as gray levels, each pixel having a value between 0 and 1. The generated images have the resolution of the mask as its size, and the gray levels (0 is the min value and 1 is the max value) determine the value of each point.

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

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

Double click on the node to open its parameters:

Exporting a mask to multiple files

To export a mask 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 mask 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 mask 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 mask will have the name Mask_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 "Mask" and then _$x_$y, where $x represents the position of the part of the mask 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.



    etc.
  • 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 mask.

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
mask/$0x/$0y/file.bmp mask/00/00/file.bmp
mask/01/00/file.bmp
mask/10/24/file.bmp
mask/$0x/$0y/file_$x_$y.bmp mask/00/00/file_0_0.bmp
mask/01/00/file_1_0.bmp
mask/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