Author Topic: Script to replace difuse  (Read 2432 times)

0 Members and 1 Guest are viewing this topic.

Offline Crocq

  • Newbie
  • *
  • Posts: 3
Script to replace difuse
« on: January 24, 2017, 07:14:55 am »
Hello guys,

I'm am a new user of Keyshot and i am looking a way to make a script to get a proper relfection map
I would replace all diffuses maps of my scene by a black map.
I there a command line to Get/Set the diffuse map in a material or any workaround?

Thank you

Offline LayC42

  • Sr. Member
  • ****
  • Posts: 358
  • mostly harmless
Re: Script to replace difuse
« Reply #1 on: January 24, 2017, 09:03:17 am »
you can add a new scene set to switch between original material and "black" material. Then apply the new black material from your library to the top group in your scene tree to change any material to the black one.
That's all - no script needed!

hope that helps

Offline Crocq

  • Newbie
  • *
  • Posts: 3
Re: Script to replace difuse
« Reply #2 on: January 24, 2017, 10:33:01 am »
 Thank LayC42,

I would like to keep roughness, specular and bump informations of each materials.
I could make multiple render with different materials overdrive and using the clown pass to use them, but it's not really an elegant solution.

Thank you for your input anyway.

Offline DMerz III

  • KeyShot Beta
  • Hero Member
  • *****
  • Posts: 813
  • David Merz the Third
    • MerzTheThird
Re: Script to replace difuse
« Reply #3 on: January 24, 2017, 12:50:45 pm »
I think LayC42 was on the right track. If you would like to not change the specular channel, but just the diffuse color, you could make a separate scene-set. And go to your Library menu > colors > Black and drag that over your scene tree to your high level parts. In theory, it should change JUST the diffuse color of everything within. No script needed.

In fact, this is how we make all "white diffuse" renders on our team, although with the added step of right clicking the high level part folder and selecting change material type to diffuse. Drag white on the folder, and viola, everything is white diffuse but all the bumps are still in tact.

hope this helps?


Offline DMerz III

  • KeyShot Beta
  • Hero Member
  • *****
  • Posts: 813
  • David Merz the Third
    • MerzTheThird
Re: Script to replace difuse
« Reply #4 on: January 24, 2017, 12:58:44 pm »
To backup my theory, I just did a quick test.
Simply dragged over the "black" color swatch from the library onto the top level folder in the scene tree.

There is one caveat, if you're using an image texture map in the diffuse channel, it will not override that unless you toggled down the diffuse channel and check the box that says BLEND WITH COLOR. This color will be black, and if the box is checked, the object will turn black.

Changed this entire scene in 10 seconds with this method.

Offline Crocq

  • Newbie
  • *
  • Posts: 3
Re: Script to replace difuse
« Reply #5 on: January 24, 2017, 05:06:19 pm »
Thats cool thank you!
But is it removing textures if there is already a diffuse map (jpg/png) ?
« Last Edit: January 24, 2017, 05:10:54 pm by Crocq »

Offline LayC42

  • Sr. Member
  • ****
  • Posts: 358
  • mostly harmless
Re: Script to replace difuse
« Reply #6 on: January 24, 2017, 11:01:43 pm »
The textures will not be removed if you hold the alt key (and/or shift for labels) while applying the material from the lib.
(sorry, short in time!)