Scatter
The Scatter node creates multiple instances of its input. It is important not to confuse the Scattering geometry node with the Scattering medium node. The node can be found under the Geometry category in the Nodegraph Editor window.
The power of the Scatter node is that it is very efficient - it's possible to load an almost unlimited number of instances into OctaneRender®. This is perfect for working with scenes that have large numbers of trees, gravel, buildings, and other objects (figure 1).
scatter node |
Figure 1: Scatter nodes are used to place a large number of rocks and trees
To use this feature, import the original geometry for instancing into OctaneRender, along with a file that contains the data for each transform matrix that represents each instance's linear transformation. The resulting data in the Scatter node is a long list of values that tells OctaneRender how and where to place each instance. The transforms are contained in a special CSV file. These files are generated using plugins or scripts and a 3D application.
Using The Scatter Node
The first step is to set up the scene in the host 3D application, then use a particle system or plugin to arrange the instances in the scene. Next, export the instanced geometry (a single rock, tree, blade of grass, etc.) as well as the CSV file, which contains the transform of each instance.
In OctaneRender, import the original mesh, then add a Scatter node to the scene. Figure 2 was created using the 3DS Max scatter plugins MultiScatter from iCube R&D, and Forest Pack® from iToo Software®.
Figure 2: Adding the Scatter node to the OctaneRender® scene
Next, connect the Instanced geometry to the Scatter node (Figure 3).
Figure 3: A Scatter node is connected to an imported Geometry node
Select the Scatter node and take a look at its attributes in the Node Inspector. Click on the Drawer icon in the upper-left corner of the Scatter parameters and use the file browser to locate the CSV file exported from the host application. Once this is connected, the instanced geometry scatters throughout the scene (Figure 4).
Figure 4: The CSV file places instances of the teapot geometry throughout the scene
Figure 5: Scatter parameters
How OctaneRender Reads A Single Transform
Each coordinate in a Scatter node represents the first three rows of a transformation matrix (the fourth is always [0, 0, 0, 1]). Each coordinate has 12 float values from a transform matrix, and then a thirteenth value is added to specify the Instance ID for that coordinate. The value for the Instance ID is user-defined, which is provided by the integrated plugins, or generated by a Lua script, or through the Transforms parameter of the Scatter node or through a CSV file. If there is no value provided for the Instance ID, as in OctaneRender 3.06.x and earlier, the Instance ID defaults to -1.
For example, the transform matrix for a 30° rotation around the Z-axis looks like this:
Figure 6: Transform matrix for a 30° rotation around the Z-axis
The coordinate in the Scatter node should contain these 13 values:
Figure 7: Scatter node coordinate
For a translation:
Figure 8: Translation values
The Scatter node contains these 13 values: 1 0 0 tx 0 1 0 ty 0 0 1 tz -1.
As the elements in the transform matrix changes, each change represents an individual transform. You need to export all the transforms from modeling applications, then load the CSV file into the Scatter node. Prior to loading the CSV file into OctaneRender, note the differences between the acceptable CSV structures for versions of OctaneRender.
The Evolution Of Scatter Data In CSV Files
You can format your own CSV files for assigning Instance IDs to each of the transforms.
Enhanced CSV structures for the Scatter node can accommodate user-defined Instance IDs set for each instance in a Scatter node. Earlier structures are supported, but the Instance IDs are set to -1 in the older structure.
CSV structure version 1 (used in OctaneRender v3.06.x and earlier): a transform is generated from every 12 float values in the file.
Figure 9: A CSV file containing four transforms
CSV structure version 2 (used in OctaneRender v3.07): Each row that represents a single Transform in OctaneRender still has the 12 float values with one float value per column. However, this time it requires a header for each column, and then add a 13th column called ID. Figure 7 shows a CSV file with 13 columns named M00, M01, M02, M03, M10, M11, M12, M13, M20, M21, M22, M23, and ID.
Each header name, from M00 to M23, suggests that these are the float values that represent each necessary element of the transform matrices. Each row is used to regenerate each of the transforms in OctaneRender and the 13th column, called ID, assigns the user Instance ID for the transform represented by that row. The data should be separated by a comma, tab, or space.
Figure 10: Used in OctaneRender v3.07.x, a CSV file containing four transforms and the user Instance ID per transform
You can enter instances manually, or you can write a script to generate the instances and export it to a CSV file. In any case, a basic understanding about the file specification is useful.
Here is an example of an instance for a Scatter node (with a few spaces added for clarity):
Figure 11: Scatter node instance example
The example above has a header with column names. The Mxx columns are the matrix elements - these are the first three rows of a 4×4 transform matrix (the fourth row by definition is (0, 0, 0, 1). The ID column is optional and contains the instance IDs. Next is the table with values. The example above contains one instance with a translation of (+10, +20, +30) and instance ID is 40. The header is optional. If it is not there, there must be 12 columns with the matrix elements. You can use comma, space, or tab as separators. OctaneRender merges multiple delimiters.