Thursday, July 19, 2018

Transfer Shader Tool

Hey it's been a while since I've posted any new tools, I've been a bit busy with work. I've polished up some knowledge I have and it's given me time to create new tools used in a small production. One problem that usually happens is when you want to transfer shaders from a model to a rig, a cache or another model, obviously of the same topology. I decided to create an easy to use tool that I have used a lot, however it contains some bugs. I know it can still be polished a lot.
It is quite easy to use and the buttons are arranged consecutively.



  • First we must have the model with the final shader to be able to pass it to the other model. Where it says "Node Type" we will have to put the name of the shader node that we want to obtain. Example: aiStandardSurface, redShiftMaterial, miaMaterialX, VRayMtl, etc. We can join more than two shader types by separating them with commas. As follows: "aiStandardSurface, redShiftMaterial", without commas.
  • Once this is done we press the "Get Faces" button, and then "Export Shader". This will write a couple of files (json. and ma.) in temporary.
  • Then we will open the other file we want to transfer the shaders to. Select the meshes and press "lambert1/Unused". This will apply lambert1 to the meshes and delete the shaders it has.
  • We will import the shaders that we had exported before, pressing the button "Import Shaders".
  • Finally we press "Assing Shader", our model should be with its correct shader. The tool will skip the meshes that do not exist in the target model.
Note: For some reason when in "Node Type" we set it to "lambert", you will get all the default Maya materials (lambert ,blinn, anisotropic, phong, phongE).

The code:

Hope you find this useful. Thanks

No comments:

Post a Comment