Here's a quick script that'll give you a way to set reflection subdivs based on how glossy a material is, I'll also be trying to figure out a way to do this based on how bertrand is using his map slots (should be fine once his glossiness is always 1.0 and he's using the map to add his small amounts of glossy) as I bought his chicago loft scene and I want it to render quicker!
Anyway, to the code!
This is tested on a very simple scene in max 2012 on objects that have vray materials, and an object with a multi sub material containing vray materials. Hope it might be useful to someone!
Anyway, to the code!
This is tested on a very simple scene in max 2012 on objects that have vray materials, and an object with a multi sub material containing vray materials. Hope it might be useful to someone!
Code:
/* Script to give a global control to set all material subdivs based on how glossy the material's reflections are. No respnsibility taken for any errors this script may cause. Written badly by John O'Connell - http://www.joconnell.com Stick thoughts or comments on the vray forums if you have ideas on features! */ try(destroydialog SetVraySamples)catch() Function setVrayMatSubdivs TheMat glossy_02 glossy_04 glossy_06 glossy_08 glossy_10 = ( case of ( (TheMat.reflection_glossiness >= 0.0 and TheMat.reflection_glossiness < 0.2): TheMat.reflection_subdivs = glossy_02 (TheMat.reflection_glossiness >= 0.2 and TheMat.reflection_glossiness < 0.4): TheMat.reflection_subdivs = glossy_04 (TheMat.reflection_glossiness >= 0.4 and TheMat.reflection_glossiness < 0.6): TheMat.reflection_subdivs = glossy_06 (TheMat.reflection_glossiness >= 0.6 and TheMat.reflection_glossiness < 0.8): TheMat.reflection_subdivs = glossy_08 (TheMat.reflection_glossiness >= 0.8 and TheMat.reflection_glossiness < 1.0): TheMat.reflection_subdivs = glossy_10 ) ) rollout SetVraySamples "Set VrayMat Samples" ( Group "Material sample amounts" ( spinner glossy_00_to_02 "Glossiness 0.0 to 0.2" range:[00,5000,100] align:#right type:#integer spinner glossy_02_to_04 "Glossiness 0.2 to 0.4" range:[00,5000,80] align:#right type:#integer spinner glossy_04_to_06 "Glossiness 0.4 to 0.6" range:[00,5000,60] align:#right type:#integer spinner glossy_06_to_08 "Glossiness 0.6 to 0.8" range:[00,5000,40] align:#right type:#integer spinner glossy_08_to_10 "Glossiness 0.8 to 1.0" range:[00,5000,20] align:#right type:#integer button DoubleVraySamples "Double samples" width:180 align:#left button HalfVraySamples "Half samples" width:180 align:#right offset:[0,-26] ) button SetVraySamples "Set Sample amounts" width:200 align:#right on DoubleVraySamples pressed do ( glossy_00_to_02.value = glossy_00_to_02.value*2 glossy_02_to_04.value = glossy_02_to_04.value*2 glossy_04_to_06.value = glossy_04_to_06.value*2 glossy_06_to_08.value = glossy_06_to_08.value*2 glossy_08_to_10.value = glossy_08_to_10.value*2 ) on HalfVraySamples pressed do ( glossy_00_to_02.value = glossy_00_to_02.value*0.5 glossy_02_to_04.value = glossy_02_to_04.value*0.5 glossy_04_to_06.value = glossy_04_to_06.value*0.5 glossy_06_to_08.value = glossy_06_to_08.value*0.5 glossy_08_to_10.value = glossy_08_to_10.value*0.5 ) on SetVraySamples pressed do ( for m in scenematerials do ( print m.name print (classof m as string) if (classof m == VrayMtl) then ( setVrayMatSubdivs m glossy_00_to_02.value glossy_02_to_04.value glossy_04_to_06.value glossy_06_to_08.value glossy_08_to_10.value ) -- Stupid messy bit to find multi sub mats theMultiMats = for o in objects where ((classof o.material) == MultiMaterial) collect o for obj in theMultiMats do ( for n = 1 to obj.material.numsubs do ( if (classof obj.material[n] == VrayMtl) then ( setVrayMatSubdivs obj.material[n] glossy_00_to_02.value glossy_02_to_04.value glossy_04_to_06.value glossy_06_to_08.value glossy_08_to_10.value ) ) ) ) ) ) CreateDialog SetVraySamples width: 400
Comment