Is there a way to compare two 'bump' attributes from different shaders?

99 Views Asked by At

I'm trying to make a plug-in that take the selected shader and create another one from the selected type (from a list of all shader).

It's not a problem to create a new shader and name it, as well as replace it on object but I'm also trying to reconnect all of its attributes and there I have a real problem.

If the source shader is a Phong and the Target type is Blinn there is no problem to reconnect all of their common attributes (I listed all attributes of my target shader with a loop in a loop, I compared them all and tried to connect if there are similar ones).

For Blinn and Phong the bump attribute is named : .normalCamera.

But my problem is :

  • for a PxrDisney, for example, the bump attribute is named: .bumpNormal.

  • for a PxLMPlastic, the bump is named: .diffuseNn.

Some ideas on how to bypass this issue?

1

There are 1 best solutions below

0
On

It isn't you - it's Maya.

Unfortunately there is no reliable way to do that. There's no guarantee that two shaders will use the same name for the same functionality, or that two shaders with similarly named attributes will use them in the same way.

You can try to maintain a mapping of attributes and use that to find the closest match, but it will always be an approximation.