Script request- Vray material options rollout/ glossy rays

Hey guys,

first of all thanks for the great content on this site and thanks to the people contributing. I am new here, and have zero scripting experience... but would it be ok to ask for a (hopefully simple) script?

When dealing with reflective/glossy materials or when I use the Vray lens effect, I get weird artefacts on my renders (I use 3dsMax 2017 and Vray 3.4). The only solution that solved this issue completely was to change for each vray material the option 'treat glossy rays as GI rays' to 'Always', in the 'options' rollout of Vray materials (the default is always set to 'only for GI rays'). In a scene with many materials, this can become quite a time-consuming job.

This is why I would like to ask for a script that can do this automatically (for all Vray materials in the scene, to automatically change the 'treat glossy rays as GI rays' option from 'only for GI rays' to 'Always'). Since I have no programming/scripting knowledge, I have no idea if that is even possible; but I thought to give it a try. Any help would be much appreciated :)

Thanks!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sable806's picture

Redundancy Check

When you use either Slate Material Editor or compact One, scene materials might not be loaded so i usually go with scene objects and get their materials. In your example if i know i have 1 million objects and one vrayMtl, i'll probably won't need a script and i'll go change the material myself. BUT, you are right i don't want to do the same operations on materials that have already been trated. So i could go for something like :

  • Creating an array which stocks the treated materials name
  • When getting an objects material, checking if it has already been processed by comparing object's material's name with names in the array
  • If Comparizon brings a match then do nothing
  • If Comparizon brings nothing then process GlossyRays as Always

Is that of any help ?

vusta's picture

ok...

now I'm not trying to be a smart ass...hence all these basic mxs questions..

what about this

for m in scenematerials do
(

check if m is vraymat
blah blah

)

does this not go thru your scene materials doesn't matter how many objects or what assignment combination there is...it simply works on materials ?

sable806's picture

Thanks for the info

You are definitely right ! I wasn't aware of this scenematerials command and thought it would be related either to Slate or Compact Material Editor. I just checked this out and yeah it would perfectly work !

for i in scenematerials do
(
 
if (classOf scenematerials[i]) == VRayMtl then
 
(
 
scenematerials[i].material.option_traceDiffuseAndGlossy = 2
 
)
 
 
)
vusta's picture

yippeeee...

glad I made a contribution....cheers

(pure fluke tho...I just thought well let search for 'scene materials' and see what comes up...first one, Poly Count post...)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.