PlantFactory and PlantCatalog Exporter can bake procedural information from the plant graph and from plant materials into vertex color sets and export them as Alembic, FBX or Pixar USD. If you haven't watched the tutorial about creating vertex color sets in PlantFactory yet, you can do so here in the Learning Center.

Exported vertex color sets can be used inside native materials of other applications and render engines for recreating procedural texturing effects which were previously only available within PlantFactory itself or within VUE. In this blog post, we will list the required nodes for using vertex color sets correctly in the material node graphs of other software.

We suggest reading the general setup and then jumping to the section of the article you need.

Table of contents:

  1. General setup
  2. Arnold
  3. Blender Cycles & Cycles 4D
  4. Octane
  5. Redshift
  6. Unreal Engine 4 & 5

General setup

PlantFactory supports the following pieces of information to be exported as vertex colors; the words in brackets indicate whether the exported vertex color is to be used as a color or as data (which means you would look at the data of each individual RGBA channel and not at the color that all channels produce):

  • Material color (color)
  • Material blending (data)
  • Leaf color shift HLS (data)
  • Ambient Occlusion (data)

The node setup for each of these properties differs by target application and render engine, but the underlying principle always remains the same. For each of the above use cases, you need a node which reads the vertex color attributes of the mesh so that you can then link the output of this node to other nodes in the material graph. Make sure to remember in which channel (R, G, B or A) you put the data in PlantFactory or PlantCatalog Exporter so that you are using the correct channel output in your target application.

Material color

The material color is meant for colorizing the material directly. All you need to do is to plug the vertex color node directly into the color or diffuse slot of each material whose color you want to control with the vertex color set.

Material Color

Material blending

Material blending is a greyscale mask that allows to smoothly blend between two different materials or texture maps on the plant, e.g. between a trunk material and a branch material. You need to plug the vertex color node into a native blender or mix node as the blending ratio / mask and the two texture maps to be blended as the two inputs for the blender.

Material blending comparison

This needs to be setup in the child material (here, we are referring to the parent and child relationship of the model structure). For example, if you wanted to blend between the trunk texture map and the branches texture map on branches that grow out from a trunk, you would need to do this in the branch material, not in the trunk material.

Leaf color shift

The leaf color shift contains color correction data in the form of hue (R), lightness (G) and saturation (B) values from the leaf node in PlantFactory which create random color variations across all leaves.

Leaf color shift

We created an OSL script which reads these values, remaps them accordingly and applies a HSL color correction to the diffuse texture map. It can be used in all render engines described in this blog post.

For Unreal Engine 4 & 5, we supply a Material Functions folder with pre-made Leaf Color Shift functions for your Unreal Engine materials.

Download OSL script / material functions

The OSL node needs to be inserted into every leaf material which is supposed to have color shifts.

 How to setup the node network for a render engine which cannot read OSL scripts:

The three RGB channels where each channel holds one of the color correction values must be plugged into a corresponding color correction node which then color-corrects the diffuse texture map of the material.

Because each application has different color correction nodes which expect different ranges for each parameter, you might need to remap the values from each channel.

Beware of color space conversion!

The values stored as vertex colors by PlantFactory are raw HSL color space values, using a RGB color as the "container" for writing the values into the mesh. If a render engine uses the HSV (hue, saturation, value) convention instead of HSL (hue, saturation, lightness) from PlantFactory, the color correction values must be converted from HSL into the HSV color space. See the article on Wikipedia for the conversion math.

 

 Fixing gray leaves after applying the HSL color shift

When using negative lightness / luminosity and saturation color correction values in PlantFactory, some render engines (e.g. Cycles, Redshift) will quickly display color corrected texture maps as gray. This side effect disappears as soon as you add colored translucency / backlight to your leaf material. Depending on the material, you might also want to experiment with color correcting not only the diffuse texture map, but also the texture map used for driving the translucency color of the leaf.

 

Ambient Occlusion

Ambient Occlusion contains pre-baked shadows in crevices and parts of the mesh which cannot be reached by light so easily. It emphasizes the overall shape of the plant and can produce improved lighting results, especially in real-time projects.

AO comparison

To add Ambient Occlusion to the material, you need to multiply the color texture with the vertex color node which reads the baked AO from the mesh. This needs to be setup for every material on the mesh.

Back to top

Arnold

Required nodes:

  • Node for reading vertex colors: User Data Color (Maya), User Data RGBA (3ds Max), Vertex Map (Cinema 4D). You need to reference (link) the vertex color set in the node. To read individual color channels, you will also need a RGBA to float (Cinema 4D) node. In Maya and 3ds Max, you can access the individual channels right from the User Data nodes.
  • Node for blending materials: Layer Shader
  • Node for multiplying AO by a texture map: Ai Multiply

Material color

The color output of the User Data Color / RGBA / Vertex Map node gets plugged into the Base Color Input of an Arnold Standard Surface.

Arnold Material Color

Material blending

You can blend materials in Arnold with a Layer Shader.

Create a new material and connect the Layer Shader to the Surface output of the Arnold material. Apply the material to the correct slot on the plant mesh.

Then, create both the parent and child materials in this new material with all texture maps connected to their corresponding inputs on two Standard Surface nodes. Then, plug the child material into Input 1 and the parent material into Input 2 of the Layer Shader.

Add a User Data Color / RGBA / Vertex Map node. Plug it into a RGBA to float node in the case of Cinema 4D. In the node, select the vertex color channel which holds the material blending mask data or use the correct output on the node. Then plug the output into the Mix 2 input of the Layer Shader to control the blending ratio.

Arnold Material Blending

Leaf color shift

Add an Ai OSL Shader node and load the OSL script. The color output of the User Data Color / RGBA / Vertex Map node gets plugged into the VertexColor input of the PlantFactory OSL Leaf Color Shift node. The diffuse texture map is fed into the TextureMap input. The output of the OSL node then controls the Base Color Input of an Arnold Standard Surface.

Arnold Leaf Color Shift

Ambient Occlusion

Add a User Data Color / RGBA / Vertex Map node. Plug it into a RGBA to float node in the case of Cinema 4D. In the node, select the vertex color channel which holds the Ambient Occlusion data or use the correct output on the node.

The output gets plugged into a Multiply node. Note that in the screenshot below, AO was put into all three channels. If you put the data into only one channel, use this very channel for all three channels in the Multiply node. The diffuse texture map also gets plugged into the Multiply node. The result controls the Base Color Input of an Arnold Standard Surface.

Arnold Ambient Occlusion

Back to top

Blender Cycles & Cycles 4D

Required nodes:

  • Node for reading vertex colors: Color Attribute (Blender 3.2 and above), Attribute (Cycles 4D for Cinema 4D). You need to reference (link) the vertex color set in the node. To read individual color channels, you will also need a Separate Color node. In the case of Cycles 4D, a Cycles attribute tag must be attached to the object so that the corresponding custom vertex color attribute can be read by the attribute node. See here for more details.
  • Node for blending materials: Mix Shader
  • Node for multiplying AO by a texture map: Mix (Color)

Material color

The color output of the Color Attribute / Attribute node gets plugged into the Principled BSDF: Base Color Input.

Blender material color

Material blending

Select all nodes in the Parent material and group them into a reusqable node with [CTRL]+[G]. Press [TAB] to exit the material group. Repeat the grouping process for all nodes in the Child material.

Create a third material. In this new material, add two Node group nodes and load the parent and child node groups you just created into the two nodes.

Add a Color Attribute / Attribute node and link the vertex color set. Plug the color output into a Separate Color node if you need to access any of the RGB channels. The alpha channel can be accessed directly in the outputs of the Color Attribute node (Blender only).

Add a Mix Shader node. Plug the channel which holds the material blending mask into the Factor Input of the node, the child material group into the first Shader Input and the parent material group into the second Shader Input. Plug the output of the Mix Shader node into the Material Surface Output. Apply the final material to the correct material slot on the mesh.

Blender blend materials

Leaf color shift

Note: To use OSL scripts in Cycles, set the device for rendering to CPU in the Cycles render settings and check the "Open shading language" checkbox.

Add a Script node and load the OSL script. The color output of the Color Attribute / Attribute node gets plugged into the VertexColor input of the PlantFactory OSL Leaf Color Shift node. The diffuse texture map is fed into the TextureMap input. The output of the OSL node then controls the Principled BSDF: Base Color Input.

Blender leaf color shift

Ambient Occlusion

The color output of the Color Attribute / Attribute node gets plugged into into a Separate Color node if you need to access any of the RGB channels. The alpha channel can be accessed directly in the outputs of the Color Attribute node (Blender only). Then, the output of the corresponding vertex color channel which holds the Ambient Occlusion data gets plugged into Input A or B of a Mix (Color) node. The Mix mode is set to Multiply.

The diffuse texture map gets plugged into the other input of the Mix node. The output of the Mix node is then plugged into the into the Material Surface Output.

Blender Ambient Occlusion

Back to top

Octane

Required nodes:

  • Node for reading vertex colors: Color Vertex Attribute (Blender, Maya & 3ds Max), Vertex Map (Cinema 4D). You need to reference (link) the vertex color set in the node. To read individual color channels, you will also need a Channel Picker node.
  • Node for blending materials: Material blender
  • Node for multiplying AO by a texture map: Multiply

Material color

The color output of the Color Vertex Attribute / Vertex Map node gets plugged into the Diffuse Channel of the Octane Diffuse material.

Octane base color

Material blending

You can blend materials in Octane either with a Mix Material or a Composite Material. Even though the Composite Material is more flexible, the Mix Material should be sufficient in this case, because you'll be blending only two materials into a new one.

Create a Mix Material and drag and drop the two materials you want to blend into its node graph and connect the child material to Material input 1 and the parent material to Material Input 2. Apply the material to the correct slot on the plant mesh.

Add a Color Vertex Attribute / Vertex Map and plug it into a Channel Picker. In the Channel Picker, select the vertex color channel which holds the material blending mask data. Then plug the output of the channel picker into the Amount input to control the blending ratio.

Octane blend materials

Leaf color shift

Add an OSL Texture node and load the OSL script. The color output of the Color Vertex Attribute / Vertex Map node gets plugged into the VertexColor input of the PlantFactory OSL Leaf Color Shift node. The diffuse texture map is fed into the TextureMap input. The output of the OSL node then controls the Diffuse Channel of the Octane Diffuse material.

Octane leaf color shift

Ambient Occlusion

The color output of the Color Vertex Attribute / Vertex Map node gets plugged into a Channel Picker. In the Channel Picker, select the vertex color channel which holds the Ambient Occlusion data. The output of the Channel Picker gets plugged into a Multiply node. The diffuse texture map also gets plugged into the Multiply node. The result controls the Diffuse Channel of the Octane Diffuse material.

Octane ambient occlusion

Back to top

Redshift

Required nodes:

  • Node for reading vertex colors: Color User Data (Maya & 3DS Max), C4D Vertex Map (Cinema 4D Redshift Xpresso material), Vertex Attribute (Cinema 4D Redshift node material). You need to reference (link) the vertex color set in the node. To read individual color channels, you will also need a Color Splitter node.
  • Node for blending materials: Material blender
  • Node for multiplying AO by a texture map: Color composite

Material color

The color output of the Color User Data / C4D Vertex Map / Vertex Attribute node gets plugged into the RS Material: Diffuse Color Input or the Base Color Input of a Redshift Standard Material.

Redshift material color

Material blending

The color output of the Color User Data / C4D Vertex Map / Vertex Attribute node gets plugged into a Color Splitter. Then, the output of the corresponding vertex color channel which holds the material blending mask is plugged into the Layer 1 Blend Color of a Material Blender node.

Redshift material blending

The parent material (e.g. the trunk) is imported into the graph (or "referenced") with a Redshift Reference node. This reference node is connected to the Layer 1 color and the "current" RS Material (e.g. the branch material) is plugged into the Base color input. The result is then plugged into the RS Material: Diffuse Color Input or the Base Color Input of a Redshift Standard Material

Leaf color shift

Add an OSL node and load the OSL script. The color output of the Color User Data / C4D Vertex Map / Vertex Attribute node gets plugged into the VertexColor input of the PlantFactory OSL Leaf Color Shift node. The diffuse texture map is fed into the TextureMap input. The output of the OSL node then controls the RS Material: Diffuse Color Input or the Base Color Input of a Redshift Standard Material.

Redshift leaf color shift

Ambient Occlusion

The color output of the Color User Data / C4D Vertex Map / Vertex Attribute node gets plugged into a Color Splitter. Then, the output of the corresponding vertex color channel which holds the Ambient Occlusion data gets plugged into the Blend Color of a Color Composite node.

Redshift ambient occlusion

The diffuse texture map gets plugged into the Base Color of the same node. The Composite mode is set to Multiply. The output of the Color Composite node is then plugged into the RS Material: Diffuse Color Input or the Base Color Input of a Redshift Standard Material.

Back to top

Unreal Engine 4 & 5

Required nodes:

  • Node for reading vertex colors: Vertex Color node
  • Node for blending materials: BlendMaterialAttributes
  • Node for multiplying AO by a texture map: Multiply

Material color

The color output of the Vertex Color node gets plugged into the Base Color Output of the new material.

Unreal material color

Material blending

Unreal Engine 5 offers two methods of blending materials: using layered materials or using the Material Instance Editor. We will be focusing on the traditional layered materials workflow.

Setup your parent and child material functions as described in the UE documentation with the MakeMaterialAttributes node and by copying all material nodes into a new material function. Then, create a new material which references the two material functions and blends them into the final material using a BlendMaterialAttributes node. Connect the child material function to Input A and the parent material function to Input B.

Unreal engine material blend

The alpha is driven by the vertex color data from a VertexColor node. Connect the output of the corresponding vertex color channel which holds the material blending mask to the Alpha Input of the BlendMaterialAttributes node (both Pixel & Vertex blend types set to "Blend"). Check "Use Material Attributes" in the parameters of the Material Output node, connect the BlendMaterialAttributes node to the Material Output and apply the material to the correct slot on the actor.

Leaf color shift

Import the downloaded Material Functions folder into your project. Then, drag and drop the PlantFactoryLeafColorShift function into the leaf material (the other functions are references used internally by this material function). Add a Vertex Color node and plug it into the corresponding input of the function, as well as the texture map. Plug the result into the Base Color Output of the material.

Unreal leaf color shift

Ambient Occlusion

The output of the corresponding vertex color channel which holds the Ambient Occlusion data of the VertexColor node gets plugged into a Multiply node.

Unreal Engine ambient occlusion

The diffuse texture map gets also plugged into the Multiply node. The output of the multiplication is then plugged into the Base Color Output of the material. 

Back to top

Daniel Seebacher I joined e-on software in 2020 as Product Marketing Specialist, after having used VUE and PlantFactory for many years. I love sharing knowledge and helping the community. In my former jobs, I was responsible for agile software development as a Product Owner and for customer support, on-site workshops and KPI reporting. In my free time, I enjoy making music, cooking for friends, reading, cycling and all kinds of videogames and movies.