Script to change one aspect of a shader?

parrotdolphinparrotdolphin Posts: 110

I have a shader that I built in shader mixer that has a slider to go from fake to real reflections. The shader is set at 0 for fake reflections. Is it possible to write a script to switch it to 1 for real reflections? I am at a lose as to how to even start to write such a script. Does anyone know how or could anyone help me out a bit? I looked at the doc at http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/start but I don't really understand it.

Comments

  • KhoryKhory Posts: 3,854
    edited December 1969

    I'm not sure why you would need a script.. If you want a one click way to change the setting just save only the reflection setting as a partial shader preset.

  • parrotdolphinparrotdolphin Posts: 110
    edited December 1969

    Khory said:
    I'm not sure why you would need a script.. If you want a one click way to change the setting just save only the reflection setting as a partial shader preset.

    Thanks Khory. I did try that, and it worked fine except I have more than one type of shader. So, it worked on the ones that were the same as the one I made the partial shader for, but it messed up the other ones. I could have a separate partial shader for each type, but then it gets sort of confusing. So that's why I am wondering if a script would be better.

  • Richard HaseltineRichard Haseltine Posts: 101,507
    edited December 1969

    How did it mess the shader up? Did it change the network to that of the shader it was saved from, or did it do something less drastic? Did you make sure that the properties had the same name and label in all shaders?

  • parrotdolphinparrotdolphin Posts: 110
    edited December 1969

    How did it mess the shader up? Did it change the network to that of the shader it was saved from, or did it do something less drastic? Did you make sure that the properties had the same name and label in all shaders?

    It changes the network to the shader it was saved from. The name and label are the same for all the shader types. All the shaders are basically the same except some have extra bricks. Maybe if I build a shader that has all the bricks from all the shaders and then save the partiual shader from that one, then it will work. I will try that when I get home from work tonight. Thanks for your help Richard.

  • Eustace ScrubbEustace Scrubb Posts: 2,701
    edited December 1969

    You've got two options: a separate preset for each shader you want to use the function on, or make all the shaders use the same internal name (the name set in ShaderMixer that the Surfaces tab lists at the top of its display, not the name of the preset to apply it from the context menu). If the preset is made in "Waldorf #5" and your figure already has "Waldorf #5" on her brass buttons, it doesn't matter that the version you made the preset from is seven months of development older (or newer) than the one you already applied: no changes will be made to the current node structure because D|S sees it as the same shader. But if your "Waldorf #5" preset is applied on a "Waldorf 5.3" surface, it will revert to the preset's version of "Waldorf #5" without fail.

    I hope that clarifies it a bit.

  • parrotdolphinparrotdolphin Posts: 110
    edited December 1969

    You've got two options: a separate preset for each shader you want to use the function on, or make all the shaders use the same internal name (the name set in ShaderMixer that the Surfaces tab lists at the top of its display, not the name of the preset to apply it from the context menu). If the preset is made in "Waldorf #5" and your figure already has "Waldorf #5" on her brass buttons, it doesn't matter that the version you made the preset from is seven months of development older (or newer) than the one you already applied: no changes will be made to the current node structure because D|S sees it as the same shader. But if your "Waldorf #5" preset is applied on a "Waldorf 5.3" surface, it will revert to the preset's version of "Waldorf #5" without fail.

    I hope that clarifies it a bit.

    Yes, that makes sense. Thanks!

    I tried my idea to make a shader with all the bricks from all the shader types and then do the partail shader off that one. But it still doesn't work. I did name it the same in Shader Mixer, like you said.

    So, now I am still wondering if a script can do what I want. I saw there is some older script doc from DS 3 so I will start looking at that and see if I can figure it out.

  • Eustace ScrubbEustace Scrubb Posts: 2,701
    edited December 1969

    You're welcome.

    I've half a mind to try code-hacking the presets for my next set to remove (actually just "comment" out) the shader-name tags to make them "universal" presets. I have little to no idea if it will even work.

  • parrotdolphinparrotdolphin Posts: 110
    edited December 1969

    You're welcome.

    I've half a mind to try code-hacking the presets for my next set to remove (actually just "comment" out) the shader-name tags to make them "universal" presets. I have little to no idea if it will even work.

    Sorry, I'm not sure what you mean.

    I did get my script to work, after looking at some of the mCasual scripts.

Sign In or Register to comment.