For example, in the situation below we have two spheres, and we want to apply separate textures to each one using the same shader.
- Assign a Standard Surface shader to both spheres and connect a file texture to the Base Color attribute.
- In the Image Name of the file node, type the following:
Where 'moon.jpg' is the name of the default texture.
<attr:> texture token
You should see that currently, both spheres receive the same texture map:
- To change the texture of one of the spheres, select the sphere and add an attribute to it - Attributes>Add Attribute. Remember to select its shape node first by pressing Select at the bottom of the attribute editor).
- In the Add Addtribute window, type the following in Long name:
mtoa constant planet
- Select String under Data Type. This will allow us to type the name of the texture in the newly created attribute.
- Under extra attributes, you should see the new attribute Mtoa Constant Planet. Enter mars in the text field next to it.
- Rendering the scene reveals the default texture (
moon.jpg) and (
mars.jpg) is assigned to the sphere with the attribute Mtoa Constant Planet (mars).