You are here: Shading and Lighting > Shader Tree Item Layers > Texture Switch Node

Texture Switch Node

The Texture Switch node allows you to dynamically choose between multiple textures based off of an Input Value. The input textures connections are ordered from bottom to top, so that when Interpolate is on, only adjacent neighbors are interpolated. The Input Value is also be wrapped, meaning that the last texture is interpolated to the first, and negative values are interpolated in the reverse direction.

Usage

You can add the Texture Switch node to the Schematic viewport using the Add function, found in the pop-up menu under Shader Inputs > Texture Switch. The textures are connected to the node by way of their relationship connection (rather than a texture output channel connected to an input). An input must also be connected to the Input Parameter to determine the switch criteria. This can be a Particle ID feature when used with Replicators (and obviously a particle source of some type) or switched on ray types or surface features, such as normal. For information on working with node graphs, see the Schematic Viewport topic.

Schematic Node: Texture Switch

Textures: This parameter receives the various relationship inputs from the source nodes. The input texture's connections are ordered from bottom to top, so that when Interpolate is on, only directly adjacent neighbors are interpolated. The Input Value is also wrapped, meaning that the last texture is interpolated to the first, and negative values are interpolated in the reverse direction.

Input Parameter: This parameter defines the criteria for switching between the various inputs. You also have the flexibility of driving the Input Value any way you like, for example, you can drive it with a gradient to control the weighting of the texture choice. In addition to linking textures as inputs, you can also link standard material groups, and any textures contained within the group is used.

Interpolate: When disabled, only a single input is expressed in the result, when enabled it acts as a blend between the various inputs.

Input Value: This value represents the switching criteria. Some examples are using a Particle ID value (expressed as a random value between 0 and 1) when applying surfacing to a group of Replicators. For two inputs this would show the first texture for any IDs between 0.0 - 0.5, and the second texture for any ID between 0.5 - 1.0. For a surface normal input the value switches based on the angle of incidence relative to the camera.

In this example, a sphere is cloned using a Replicator and a particle source. The Texture Switch node is being output to the surface's Diffuse Color channel and chooses between three possible texture inputs, Grid, Cellular or Dots. The Input Value is being driven by Particle ID used to generate a random value between 0 & 1. In the image on the left, with Interpolate off, we see that replicas with ID's between 0 & 1/3 use the Dots texture, between 1/3 & 2/3 use the Cellular texture, and between 2/3 & 1 get the Grid texture. In the image on the right, with Interpolate on, we get a blend of the adjacent textures.