Thursday, September 19, 2013

Sampling one texture with different settings

Some times you may want to sample a single texture with different settings, such as different UVs.

You can of course place down multiple "Texture Map" nodes and point them all to the same texture.
Then connect different UVs into each.

This works ok, but becomes a problem when you want to expose the texture path to the Attribute Editor as a parameter for artists to set when the node graph is closed. You really want  the artist to only have to supply the path to the texture once. 

When using Texture Map nodes, each would need to be visible to the AE in order for the path to be set. It would be strange for the artist to have to set the same texture in the shader multiple times. We can resolve this by constructing the sampling with your own set of nodes instead of using the Texture Map node.

To see these nodes, you should switch to "Advanced Mode" in the right-click menu.

You can look inside the Texture Map node for reference.

Here is an image with some explanation of how you can set this up:


The above example assumes you are using a regular 2D texture.
If you want to use a Cube texture, then you must also add a "Texture Type" node, set it to Cube and input it into each of the four nodes in the picture.