Hi,
Here a little trick to show you how we can connect multiple shaders or texture on one mesh/object.
I use this technique in production, when the animation guy give me one mesh with a cache.
The scene :
A chair, with 5 shaders (red, blue, yellow, green, white).
We have 5 shaders, so, we must set all UV in 5 « UV space » in the same UVset. See the image, you will understand :
To move you uv, you can use this mel :
polyEditUV -u 0 -v -1 for UV space U 0 and V -1 (red here)
If you want move you UV like « blue » space, you must select your UV and write : polyEditUV -u -1 -v -1
Yellow : polyEditUV -u -1 -v 0
etc etc…
After that, combine all meshs in one mesh.
Build your « one » shader :
We will start to merge the « white » shader and the « yellow » shader.
To do this, we use the « blendColor » utility.
When the blender attribut in the blendColor utility is set to 1, we have the color 1. When is set to 0, we have the color 2.
Create a ramp with one white color, and a dark default color.
Now select the « place2dTexture » from your ramp, uncheck wrap U, unckeck wrap V.
In the translate frame attribut, set the same value like you UV space for every shaders.
For example, for the « yellow shader », we set the value to -1 and 0.
When we do this, we have a white color in the -1, 0 UV space, and a black color in other UV space.
Now it is simple, connect the outColorR (or B or G) of the ramp to blender attribut of the blendColors.
And connect the output of the blendColors to a surfaceShader. Apply the surface shader in your object, here, my chair.
If your render your image, you will have this :
So, connect your « yellow » shader in the red slot (color 1) on the blendColor utility.
Now in the blue slot, you will connect and other blendColor utility (blendColor2).
Now we must apply the green shader.
Create a white ramp, default color to black, uncheck wrap U, wrap V, and set the value of the translate frame to 1, -1.
Like before, connect this ramp on the blender attribut of the blendColor2.
In the color 1, connect your green shader.
Your will have this :
Now continu with the same logic on all UV space and you will have this :
Enjoy !
This trick work also for texture map.
It a little like in this tutorial:
http://features.cgsociety.org/story_custom.php?story_id=4006&page=2
http://features.cgsociety.org/stories/2007_04/night_elf/aft_03.jpg
Another technique I use sometime:
Instead of have many uv spaces, I put all the uv in « many rectangle » in the « standard » uv space and just change the uv coord in the place2Dtexture. This is usefull because it permit to have rectangular textures.
Le blog de Damien BATAILLE
ytsejam
Hi Damien, Great.