ScriptSpot

Forum topic · General Scripting

Automate V-Ray Material - Diffuse 2 Bump & Displace

By W DIGITAL · 2012-10-13

Description

hi

does anyone know how to script the procedure of moving the diffuse map into bump and displace map slot, and also enabling displace and setting the value to 3 ?

that would be awesome!

thanks for any help

Comments (5)

vinyvince · 2017-08-27

Doesn t seem to work on max2017sp3 and latest Vray...

who could help please?

Thanks vincent*
bout_de_lune@yahoo.com

W DIGITAL · 2012-10-15

thank you barigazy!

very helpful

final solution

barigazy · 2012-10-13

This function will better fit into all of this

fn diff2BumpDispl vrMat bMulti: displMuli: asCopy: =
(
if isKindOf vrMat VRayMtl do
(
vrDiff = vrMat.texmap_diffuse
if vrDiff != undefined do
(
if asCopy then (vrMat.texmap_bump = vrMat.texmap_displacement = vrDiff)
else (vrMat.texmap_bump = copy vrDiff ; vrMat.texmap_displacement = copy vrDiff)
vrMat.texmap_bump_multiplier = bMulti
vrMat.texmap_displacement_multiplier = displMuli
)
)
)
--this will create instance of diffuse map in bump and displacement slot
diff2BumpDispl meditMaterials[1] bMulti:30 displMuli:3 asCopy:false
--this will create copy of diffuse map in bump and displacement slot
diff2BumpDispl meditMaterials[1] bMulti:30 displMuli:3 asCopy:true

barigazy · 2012-10-13

Now the bump and displacement maps are instances of diffuse map.
But if you want to be copy of diffuse map than replace line7 with


vrMat.texmap_bump = copy vrDiff ; vrMat.texmap_displacement = copy vrDiff

Like this

barigazy · 2012-10-13


vrMat = meditMaterials[1] -- or $.material
if isKindOf vrMat VRayMtl do
(
vrDiff = vrMat.texmap_diffuse
if vrDiff != undefined do
(
vrMat.texmap_bump = vrMat.texmap_displacement = vrDiff
vrMat.texmap_bump_multiplier = 30
vrMat.texmap_displacement_multiplier = 3
)
)