Caffeine Abuse - The Blog

Using individual textures in shared materials

The reason you apply the same material on multiple objects in the first place is usually because you want them to be exactly the same. That’s pretty much the definition of sharing the very same material. With that being said, let’s discuss how you can setup a shared material but still being able to control parts of it on a per object basis. While this answer confines to using an individual texture, there’s nothing stopping you from adding additional individuality. But then again, if you really want completely different appearance for each and every object you’re probably better of using separate materials in the first place. 

Start by opening the scene tubes.scn from this issues DVD. Select the first tube, tube_No1, and from the Get > Material menu choose Blinn. Select the other two tubes and from the Get > Material menu choose Assign Material and pick the first tube to assign the same material. Select the first tube again and from the From the Get > Property > Texture Map menu choose Texture Map. In the Clip section of the Texture Map PPG, click the New button and select New From File… from the menu. Brows to the project folder on the DVD, select the tube_No1.pic image and click OK. In the UV Property section, click the drop down list and select the Tube_UV. Close the PPG. Texture Maps are commonly used to control specific parameters in a scene, such as hair color, particle emission or restricting the areas affected by deformers, using an image. And as such they’re generally not used to actually texture an object. The main difference between the ‘traditional way’ of using an image node in the Render Tree and using the texture map is that the texture map property sits on the geometry/object rather than being part of the material. Repeat the same procedure for tube_No2 and tube_No3 but choose their respective image.

Select any of the tubes and press [7] to open a Render Tree. From the Nodes > Map Lookups menu choose Color. The color map lookup node enables you to extract different types of data from the object, such as a texture map, and use it as a color value in the Render Tree. In the Map_lookup_color PPG, click the Map dropdown list and choose Texture_Map. The texture map lookup of the material is shared between all the objects but since their actual texture maps are unique, they will get assigned an individual texture. Connect the Map_lookup_color node to the Diffuse and Ambient input of the Blinn node.

The project files used in this tutorial can be found at:http://dl.dropbox.com/u/3834689/CaffeineAbuse/Individual_Textures_Shared_Materials.zip

Textures_in_Shared_Materials_img02

The texture maps, which hold both the actual texture and the UV Coordinates, are assigned directly to the object. While the texture maps are commonly used to control attributes of an operator rather than using it as an actual texture, there is no reason it can’t be used as such.

Quick tip
An object isn’t limited to using a single texture map, so for additional images such as bumpmaps, simply add a second texture map with respective images and a Color Lookup to use it in the Render Tree.