View Full Version : Swap Shader

10 October 2006, 04:39 AM
Hey guys

I need a script that will swap my Phong shader with a Constant and move the image node that used to be connected to the phong diffuse to the Constant color input.

Is there anything like that out there?

Right and for 5.1. Thanks


10 October 2006, 05:26 AM
If you just need a cut between the two you can use a boolean switch node to swap between the two shaders. If you need something where it fades from one to the other you can probably use a mix 2 colors for that. Just plug your image into both the phong and the constant shader and you're all set. If you need to use an expression to change between the two nodes, you can assign it to the mix node of the mix2colors or the switch node of the boolean switch.

XSI isn't really picky about how the shaders are set up, you can even assign different shaders to different nodes of a gradient or mix8colors node and xsi will render all of them on the same object at the same time. I think the only exception to this is the toon shaders which have to be plugged directly into the material node.

10 October 2006, 01:42 PM
Thanks SBowling

However, I have to do that for 100's of materials. Not exactly something that I want to do by hand.

Thats why I need a scripting solution.

Last night I was able to get the new shader plugged in via script, but my problem is that I some how need to find what is plugged into the old shader so I can script plugging the image node into the shader. Especially when names are all different.

Anyone know how to find out what is plugged into a shader via script?

CGTalk Moderation
10 October 2006, 01:42 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.