One other helpful bit to spend some time on: the all-important “show” command.
It’s the short form of the command “showProperties”, and it does just that: given a node, it will print its properties in the listener (or readable/writable parameter set. In other words, the stuff one needs to edit to have an effect on anything.).
For example, let’s try and figure out the name of the reflection glossiness texture slot in a V-Ray material, because we really need to clear that out from all materials in our scene.
I’ll comment in-line this time: anything after “--” in the code below is a comment for humans to read, and won’t be executed by Max.
First, let’s query the properties of the vrayMtl
( -- start of the local scope. [I]What goes on in the local scope, stays in the local scope.[/I] [I]Use a set of brackets around your scripts whenever you can[/I]!
myTempMaterial = vrayMtl() --notice the brackets after "vrayMtl". those ensure an instance of the class is created. It's then assigned to (stored into) the variable "myTempMaterial", on the other side of the equal sign
show myTempMaterial --this line will print out all the properties of whatever was saved inside that variable. In our case, the vrayMtl.
)
Short form of the above:
show (vrayMtl()) --in this case we create a throwaway version of a vrayMtl, stored nowhere in particular, which will disappear after having been queried by the show command. We only need the printout of the parameters, after all.
Now, brace for some text. Know, however, that within a few seconds you’ll be an expert reading it.
Each line is a property of our material (or “node”, in general).
Each property is listed with its dot at the beginning (f.e. “.diffuse”. We access node properties like this: “myMaterial.diffuse”. So it’s a nice copy/paste shortcut to have the dot present.), and a description of what kind of parameter it expects, after the columns (f.e. RGB Color, Float, Boolean, and so on.).
Parameters with a set of brackets after the name (f.e. reflection_exitColor (reflect_exitColor)) show also an Alias to the parameter name (in other words, one can use either form to query/modify a parameter.).
Here then is the result of either of the above scripts:
.diffuse : RGB color
.diffuse_roughness : float
.selfIllumination : RGB color
.selfIllumination_gi : boolean
.selfIllumination_multiplier : float
.compensate_camera_exposure : boolean
.reflection : RGB color
.reflection_glossiness : float
.hilight_glossiness (notUsed) : float
.reflection_subdivs : integer
.reflection_fresnel : boolean
.reflection_maxDepth : integer
.reflection_exitColor (reflect_exitColor) : RGB color
.reflection_useInterpolation (useInterpolation) : boolean
.reflection_ior : float
.reflection_metalness : float
.reflection_lockGlossiness : boolean
.reflection_lockIOR : boolean
.reflection_dimDistance : worldUnits
.reflection_dimDistance_on : boolean
.reflection_dimDistance_falloff : float
.reflection_affectAlpha : integer
.refraction : RGB color
.refraction_glossiness : float
.refraction_subdivs : integer
.refraction_ior : float
.refraction_fogColor : RGB color
.refraction_fogMult (refraction_fogMultiplier) : float
.refraction_fogBias : float
.refraction_affectShadows : boolean
.refraction_affectAlpha : integer
.refraction_maxDepth : integer
.refraction_exitColor (refract_exitColor) : RGB color
.refraction_useExitColor (refract_useExitColor) : boolean
.refraction_useInterpolation : boolean
.refraction_dispersion (refract_dispersion) : float
.refraction_dispersion_on (refract_dispersion_on) : boolean
.translucency_on (translucency_type) : integer
.translucency_thickness : worldUnits
.translucency_scatterCoeff : float
.translucency_fbCoeff : float
.translucency_multiplier : float
.translucency_color (translucent_color) : RGB color
.brdf_type : integer
.anisotropy (brdf_anisotropy) : float
.anisotropy_rotation (brdf_anisotropy_rotation) : float
.anisotropy_derivation (brdf_anisotropy_derivation) : integer
.anisotropy_axis (brdf_anisotropy_axis) : integer
.anisotropy_channel (brdf_anisotropy_channel) : integer
.soften (brdf_soften) : float
.brdf_fixDarkEdges : boolean
.gtr_gamma : float
.gtr_oldGamma : boolean
.brdf_useRoughness (option_useRoughness) : boolean
.option_traceDiffuse : boolean
.option_traceReflection : boolean
.option_traceRefraction : boolean
.option_doubleSided : boolean
.option_reflectOnBack : boolean
.option_useIrradMap : boolean
.refraction_fogUnitsScale_on (refraction_fogUnitScale_on) : boolean
.option_traceDiffuseAndGlossy : integer
.option_cutOff : float
.preservationMode : integer
.option_environment_priority : integer
.effect_id : integer
.override_effect_id : boolean
.option_clampTextures : boolean
.option_opacityMode : integer
.option_glossyFresnel : boolean
.option_diffuse_roughness_model : integer
.texmap_diffuse : texturemap
.texmap_diffuse_on : boolean
.texmap_diffuse_multiplier : float
.texmap_reflection : texturemap
.texmap_reflection_on : boolean
.texmap_reflection_multiplier : float
.texmap_refraction : texturemap
.texmap_refraction_on : boolean
.texmap_refraction_multiplier : float
.texmap_bump : texturemap
.texmap_bump_on : boolean
.texmap_bump_multiplier : float
.texmap_reflectionGlossiness : texturemap
.texmap_reflectionGlossiness_on : boolean
.texmap_reflectionGlossiness_multiplier : float
.texmap_refractionGlossiness : texturemap
.texmap_refractionGlossiness_on : boolean
.texmap_refractionGlossiness_multiplier : float
.texmap_refractionIOR (texmap_ior) : texturemap
.texmap_refractionIOR_on (texmap_ior_on) : boolean
.texmap_refractionIOR_multiplier (texmap_ior_multiplier) : float
.texmap_displacement : texturemap
.texmap_displacement_on : boolean
.texmap_displacement_multiplier : float
.texmap_translucent : texturemap
.texmap_translucent_on : boolean
.texmap_translucent_multiplier : float
.texmap_environment : texturemap
.texmap_environment_on : boolean
.texmap_hilightGlossiness : texturemap
.texmap_hilightGlossiness_on : boolean
.texmap_hilightGlossiness_multiplier (notUsed) : float
.texmap_reflectionIOR : texturemap
.texmap_reflectionIOR_on : boolean
.texmap_reflectionIOR_multiplier : float
.texmap_opacity : texturemap
.texmap_opacity_on : boolean
.texmap_opacity_multiplier : float
.texmap_roughness : texturemap
.texmap_roughness_on : boolean
.texmap_roughness_multiplier : float
.texmap_anisotropy : texturemap
.texmap_anisotropy_on : boolean
.texmap_anisotropy_multiplier : float
.texmap_anisotropy_rotation : texturemap
.texmap_anisotropy_rotation_on : boolean
.texmap_anisotropy_rotation_multiplier : float
.texmap_refraction_fog (texmap_fog) : texturemap
.texmap_refraction_fog_on (texmap_fog_on) : boolean
.texmap_refraction_fog_multiplier (texmap_fog_multiplier) : float
.texmap_self_illumination (texmap_selfIllumination) : texturemap
.texmap_self_illumination_on (texmap_selfIllumination_on) : boolean
.texmap_self_illumination_multiplier (texmap_selfIllumination_multiplier) : float
.texmap_gtr_tail_falloff : texturemap
.texmap_gtr_tail_falloff_on : boolean
.texmap_gtr_tail_falloff_multiplier : float
.texmap_metalness : texturemap
.texmap_metalness_on : boolean
.texmap_metalness_multiplier : float
If you recall, we wanted to get rid of the reflection glossiness texture: you’ll notice there is an ample section of parameters, near the bottom, with “texmap_” in the name.
Sure enough, there are three parameters which look promising:
.texmap_reflectionGlossiness : texturemap
.texmap_reflectionGlossiness_on : boolean
.texmap_reflectionGlossiness_multiplier : float
The first, as can be deduced, contains the texture map itself (or a value of “undefined” if no texture was plugged in.).
The second and third parameters, however, determine if the map is active (boolean value: on/off, true/false, 0/1), and the map influence amount (float value: 75.3, 100.0, 0.0 and so on).
So, we can do one of three things to turn off that map: delete the map entirely, turn off the map (which remains in its place) or zero its influence.
Three little scripts then, for each of the above cases.
Let’s wipe the maps entirely from the scene first:
(
myMaterials = getclassinstances vrayMtl --Collecting all the V-ray materials in the scene
for myMat in myMaterials do myMat.texmap_reflectionGlossiness = undefined --assigning "undefined" as texture for that slot deletes it entirely
)
Second, let’s be more conservative and just turn those off
(
myMaterials = getclassinstances vrayMtl --Collecting all the V-ray materials in the scene
for myMat in myMaterials do myMat.texmap_reflectionGlossiness_on = false --The "on" property set to false means "off"
)
Third, let’s do it through the map influence spinner
(
myMaterials = getclassinstances vrayMtl --Collecting all the V-ray materials in the scene
for myMat in myMaterials do myMat.texmap_reflectionGlossiness_multiplier = 0.0 --Setting map influence to 0.0
)
We have already seen how to “inline” things, so to return to one-liners, here’s how to turn off (not delete!) the map for the reflection glossiness:
(
for myMat in (getclassinstances vraymtl) do myMat.texmap_reflectionGlossiness_on = false
)
This was a lot of reading, but the show command is really quite useful.
For example,
show renderers.current
Will print out all the accessible parameters for your current renderer, so that you may be able to tweak things even if no UI is present.
Feel free to experiment, ideally in a safe situation (don’t blame me if you disintegrate a production scene which needed to be out of the door instead!
).