MM_ShaderTools
- April 24th, 2012
- Write comment
MM ShaderTools is a plugin which helps you to batch replace, create or modify shaders in all your materials at once. This can save huge amounts of time, especially in later stages of a project. You can select multiple materials or lights and run the plugin to modify your render trees with three different operations:
Replace shaders: will replace all instances of the same shader by a new one. You have options which will help you to keep all connections in and out of the shaders intact. Additionally you can set parameters in the newly created shader, either directly or based on parameter values of the old shader.
- Insert shader: insert a new shader between a specified connection. Similar to replace shaders you have options to keep all connections intact and additionally set parameters in the new shader. You can also use this to simply import and connect a shader without inserting it into an existing connection.
- Set Shader Parameters: allows you to set parameters of all kinds in a target shader.
The first version of my Mia Material Advanced shader used to be a compound. But soon I found out about an annoying softimage bug which caused a massive slowdown prior to rendering when using shader compounds with a lot of exposed parameters. So I developed a new version which packed all the functionality into one shader phenomena. Unfortunately we had used the compound already in several projects and assets which we had to reuse later on. So I created the initial version of the script, which I used to replace all the Mia Advanced compounds in a scene with the new shader phenomena, while keeping all connections intact. I really liked the performance of the script and so I decided to massively extend it in my spare time, to make it work in all kinds of possible situations.
So why use this? It’s maybe not the most user friendly way to work with materials, but there are many cases I can think of where this plugin could prove extremely useful. As described above, Replace Shaders can easily update shaders to a newer or better version. Another nice possibility would be to quickly convert entire scenes to work with different render engines like VRay or Arnold. A combination of Replace Shaders and Insert Shader could be used to create complex render channel setups you might not have thought of before creating your materials. And Set Shader Parameters can of course become handy in all sorts of situations. Enable Elliptical filtering or change texture repeats in all your image nodes. Or increase sampling values in all your illumination shaders at once…
Here is a quick use case example of how I converted a production scene from Mental Ray to Arnold with the help of MM_Shadertools:
Below are some (uncomped) test renderings of the soccer stadium I’ve created during the production of our Grundig spot. The rendering was done in mental ray and I used my Mia Material Advanced for almost all the materials (about 100 different Materials) in this scene.
First I replaced the Mia Material with Arnolds Standard Material,with reconnect local bump map connections to material option on. This took about 2minutes for all 100 materials. Then I replaced all Mia Material Wrappers by a color Pass trough shader since they weren’t required anymore.
Next I replaced all bump map shaders with arnolds own bump map shader, inverted all scalar change range nodes (since I knew I used them a lot to texture the glossiness which is the inverse in Arnold’s Standard Material) and replaced the Mental Ray rayswitches by Arnold switches. These conversions all took only a couple of seconds.
Next up where the various lights in the scene and finally the environment (which I quickly updated by hand).
I had to manually tweak a few lights and exchange 2 or 3 other mental ray shaders. But after about 20 minutes of tweaking I ended up with the renderings below. They’re not perfect and require another fair amount of tweaking, but I think they’re a very good starting point, and it took me about half an hour to get there. Which isn’t bad in my opinion considering that this was a full production scene.
Here is a small help page I’ve set up to describe in detail the various functions of the plugin. You can also call this help page directly from the plugins help button:
The archive contains the plugin, plus some presets I’ve been using so far. One more word of advice: since the plugin can massively change or even remove stuff from your materials it’s heavily recommended to save your scene before running the script. And since it proved very complex to handle all possible exceptions (especially concerning shader compounds) there might very well be some bugs left. So use it at your own risk and in case you encounter any problems don’t hesitate to email me and I will see what I can do.
Have fun and let me know if you like the plugin!



































