All Vray elements

This might be handy for scripting..

It generates all vray elements,
this way you can turn on and off for each layer..

Cheerio :slight_smile:

global proc VrayZDEPTH()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Z_depth”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Z_depth;
setAttr -type “string” vrayRE_Z_depth.vrayClassType zdepthChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Z_depth;
setAttr “vrayRE_Z_depth.enabled” 1;
vrayAddAttr(“vrayRE_Z_depth”,“vray_depthBlack”);
vrayAddAttr(“vrayRE_Z_depth”,“vray_depthWhite”);
vrayAddAttr(“vrayRE_Z_depth”,“vray_depthClamp”);
vrayAddAttr(“vrayRE_Z_depth”,“vray_name_zdepth”);
vray getAHint “RenderElementAttribute” “vray_depthBlack” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_depthWhite” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_depthClamp” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_name_zdepth” “vray_parameter”;
connectAttr vrayRE_Z_depth.outConnect vraySettings.relements_connect[0];
}

global proc VrayMATERIALID()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Material_ID”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Material_ID;
setAttr -type “string” vrayRE_Material_ID.vrayClassType materialIDChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Material_ID;
setAttr “vrayRE_Material_ID.enabled” 1;
vrayAddAttr(“vrayRE_Material_ID”,“vray_alias_mtlid”);
vrayAddAttr(“vrayRE_Material_ID”,“vray_filename_mtlid”);
vrayAddAttr(“vrayRE_Material_ID”,“vray_considerforaa_mtlid”);
vray getAHint “RenderElementAttribute” “vray_alias_mtlid” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_filename_mtlid” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_considerforaa_mtlid” “vray_parameter”;
connectAttr vrayRE_Material_ID.outConnect vraySettings.relements_connect[1];
}

global proc VrayMATTESHADOW()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Matte_shadow”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Matte_shadow;
setAttr -type “string” vrayRE_Matte_shadow.vrayClassType matteShadowChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Matte_shadow;
setAttr “vrayRE_Matte_shadow.enabled” 1;
vrayAddAttr(“vrayRE_Matte_shadow”,“vray_alias_matteshadow”);
vrayAddAttr(“vrayRE_Matte_shadow”,“vray_name_matteshadow”);
vray getAHint “RenderElementAttribute” “vray_alias_matteshadow” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_name_matteshadow” “vray_parameter”;
connectAttr vrayRE_Matte_shadow.outConnect vraySettings.relements_connect[2];
}

global proc VrayEXTRATEX()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Extra_Tex”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Extra_Tex;
setAttr -type “string” vrayRE_Extra_Tex.vrayClassType ExtraTexElement;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Extra_Tex;
setAttr “vrayRE_Extra_Tex.enabled” 1;
vrayAddAttr(“vrayRE_Extra_Tex”,“vray_name_extratex”);
vrayAddAttr(“vrayRE_Extra_Tex”,“vray_texture_extratex”);
vrayAddAttr(“vrayRE_Extra_Tex”,“vray_considerforaa_extratex”);
vrayAddAttr(“vrayRE_Extra_Tex”,“vray_affectmattes_extratex”);
vray getAHint “RenderElementAttribute” “vray_name_extratex” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_texture_extratex” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_considerforaa_extratex” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_affectmattes_extratex” “vray_parameter”;
connectAttr vrayRE_Extra_Tex.outConnect vraySettings.relements_connect[3];
}

global proc VrayMATERIALSELECT()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Material_Select”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Material_Select;
setAttr -type “string” vrayRE_Material_Select.vrayClassType MaterialSelectElement;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Material_Select;
setAttr “vrayRE_Material_Select.enabled” 1;
vrayAddAttr(“vrayRE_Material_Select”,“vray_name_mtlselect”);
vrayAddAttr(“vrayRE_Material_Select”,“vray_colorMapping_mtlselect”);
vrayAddAttr(“vrayRE_Material_Select”,“vray_mtl_mtlselect”);
vray getAHint “RenderElementAttribute” “vray_name_mtlselect” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_colorMapping_mtlselect” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_mtl_mtlselect” “vray_parameter”;
connectAttr vrayRE_Material_Select.outConnect vraySettings.relements_connect[4];
}

global proc VrayREFRACTION()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Refraction”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Refraction;
setAttr -type “string” vrayRE_Refraction.vrayClassType refractChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Refraction;
setAttr “vrayRE_Refraction.enabled” 1;
vrayAddAttr(“vrayRE_Refraction”,“vray_alias_refract”);
vrayAddAttr(“vrayRE_Refraction”,“vray_name_refract”);
vrayAddAttr(“vrayRE_Refraction”,“vray_colorMapping_refract”);
vray getAHint “RenderElementAttribute” “vray_alias_refract” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_name_refract” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_colorMapping_refract” “vray_parameter”;
connectAttr vrayRE_Refraction.outConnect vraySettings.relements_connect[5];
}

global proc VrayREFLECTION()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Reflection”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Reflection;
setAttr -type “string” vrayRE_Reflection.vrayClassType reflectChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Reflection;
setAttr “vrayRE_Reflection.enabled” 1;
vrayAddAttr(“vrayRE_Reflection”,“vray_alias_reflect”);
vrayAddAttr(“vrayRE_Reflection”,“vray_name_reflect”);
vrayAddAttr(“vrayRE_Reflection”,“vray_colorMapping_reflect”);
vray getAHint “RenderElementAttribute” “vray_alias_reflect” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_name_reflect” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_colorMapping_reflect” “vray_parameter”;
connectAttr vrayRE_Reflection.outConnect vraySettings.relements_connect[6];
}

global proc VraySPECULAR()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Specular”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Specular;
setAttr -type “string” vrayRE_Specular.vrayClassType specularChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Specular;
setAttr “vrayRE_Specular.enabled” 1;
vrayAddAttr(“vrayRE_Specular”,“vray_alias_specular”);
vrayAddAttr(“vrayRE_Specular”,“vray_name_specular”);
vrayAddAttr(“vrayRE_Specular”,“vray_colorMapping_specular”);
vray getAHint “RenderElementAttribute” “vray_alias_specular” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_name_specular” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_colorMapping_specular” “vray_parameter”;
connectAttr vrayRE_Specular.outConnect vraySettings.relements_connect[7];
}

global proc VraySSS()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_SSS”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_SSS;
setAttr -type “string” vrayRE_SSS.vrayClassType FastSSS2Channel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_SSS;
setAttr “vrayRE_SSS.enabled” 1;
vrayAddAttr(“vrayRE_SSS”,“vray_alias_sss”);
vrayAddAttr(“vrayRE_SSS”,“vray_name_sss”);
vrayAddAttr(“vrayRE_SSS”,“vray_colorMapping_sss”);
vray getAHint “RenderElementAttribute” “vray_alias_sss” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_name_sss” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_colorMapping_sss” “vray_parameter”;
connectAttr vrayRE_SSS.outConnect vraySettings.relements_connect[8];
}

global proc VrayGI()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_GI”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_GI;
setAttr -type “string” vrayRE_GI.vrayClassType giChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_GI;
setAttr “vrayRE_GI.enabled” 1;
vrayAddAttr(“vrayRE_GI”,“vray_alias_gi”);
vrayAddAttr(“vrayRE_GI”,“vray_name_gi”);
vrayAddAttr(“vrayRE_GI”,“vray_colorMapping_gi”);
vray getAHint “RenderElementAttribute” “vray_alias_gi” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_name_gi” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_colorMapping_gi” “vray_parameter”;
connectAttr vrayRE_GI.outConnect vraySettings.relements_connect[9];
}

the rest

global proc VrayVELOCITY()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Velocity”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Velocity;
setAttr -type “string” vrayRE_Velocity.vrayClassType velocityChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Velocity;
setAttr “vrayRE_Velocity.enabled” 1;
vrayAddAttr(“vrayRE_Velocity”,“vray_clamp_velocity”);
vrayAddAttr(“vrayRE_Velocity”,“vray_max_velocity”);
vrayAddAttr(“vrayRE_Velocity”,“vray_max_velocity_last_frame”);
vrayAddAttr(“vrayRE_Velocity”,“vray_ignorez_velocity”);
vrayAddAttr(“vrayRE_Velocity”,“vray_filename_velocity”);
vray getAHint “RenderElementAttribute” “vray_clamp_velocity” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_max_velocity” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_max_velocity_last_frame” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_ignorez_velocity” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_filename_velocity” “vray_parameter”;
connectAttr vrayRE_Velocity.outConnect vraySettings.relements_connect[10];
}

global proc VraySHADOW()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Shadow”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Shadow;
setAttr -type “string” vrayRE_Shadow.vrayClassType shadowChannel;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Shadow;
setAttr “vrayRE_Shadow.enabled” 1;
vrayAddAttr(“vrayRE_Shadow”,“vray_alias_shadow”);
vrayAddAttr(“vrayRE_Shadow”,“vray_name_shadow”);
vrayAddAttr(“vrayRE_Shadow”,“vray_colorMapping_shadow”);
vray getAHint “RenderElementAttribute” “vray_alias_shadow” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_name_shadow” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_colorMapping_shadow” “vray_parameter”;
connectAttr vrayRE_Shadow.outConnect vraySettings.relements_connect[11];
}

global proc VrayMULTIMATTE()
{
shadingNode -asUtility VRayRenderElement;
rename VRayRenderElement1 “vrayRE_Multi_Matte”;
addAttr -ln “vrayClassType” -dt “string” vrayRE_Multi_Matte;
setAttr -type “string” vrayRE_Multi_Matte.vrayClassType MultiMatteElement;
addAttr -ln “enabled” -at “bool” -dv 1 vrayRE_Multi_Matte;
setAttr “vrayRE_Multi_Matte.enabled” 1;
vrayAddAttr(“vrayRE_Multi_Matte”,“vray_name_multimatte”);
vrayAddAttr(“vrayRE_Multi_Matte”,“vray_redon_multimatte”);
vrayAddAttr(“vrayRE_Multi_Matte”,“vray_redid_multimatte”);
vrayAddAttr(“vrayRE_Multi_Matte”,“vray_greenon_multimatte”);
vrayAddAttr(“vrayRE_Multi_Matte”,“vray_greenid_multimatte”);
vrayAddAttr(“vrayRE_Multi_Matte”,“vray_blueon_multimatte”);
vrayAddAttr(“vrayRE_Multi_Matte”,“vray_blueid_multimatte”);
vrayAddAttr(“vrayRE_Multi_Matte”,“vray_usematid_multimatte”);
vray getAHint “RenderElementAttribute” “vray_name_multimatte” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_redon_multimatte” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_redid_multimatte” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_greenon_multimatte” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_greenid_multimatte” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_blueon_multimatte” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_blueid_multimatte” “vray_parameter”;
vray getAHint “RenderElementAttribute” “vray_usematid_multimatte” “vray_parameter”;
connectAttr vrayRE_Multi_Matte.outConnect vraySettings.relements_connect[12];
}

I’ve modified our scripts so adding render elements through MEL is easier and more robust. In builds after 2010-05-15, when you select a render element in the “available render elements” list in the Render elements tab in Render settings, V-Ray will print something like this in the script editor :
“”"
Selected render elements can be added with :
vrayAddRenderElement specularChannel;
vrayAddRenderElement lightingChannel;
vrayAddRenderElement giChannel;
“”"

You can copy and execute all but the first line to add the render elements you’ve selected.

You can remove a render element by issuing the following command :
vrayRemoveRenderElement vrayRE_Specular;
where vrayRE_Specular is the name of the node of the element ( the name is listed in “Added render elements”).

Greetings,
Vladimir Nedev

Hope i don’t have to rescript them all :slight_smile:

Using these now..

No, you won’t have to, but the way you did it, won’t pick up any new parameters we add to some of the render elements. Also the connection to the vraySettings.relements_connect creates some problems with referenced scenes so we removed that and we no longer create the render elements as an utility shading node. The new commands are better for that reason, you get automatically any updates that we make to the render elements. It’s also easier for you to figure out how to create new elements, adding all the attributes one by one is somewhat tedious. :slight_smile:

Greetings,
Vladimir Nedev

Yeah “connectAttr vrayRE_GI.outConnect vraySettings.relements_connect[9];”

I stopped using a long time ago,

just the shadingNode -asUtillity VRayRenderElement, I still need, cause i made soo many scripts with this :slight_smile:

O