9/27/14

MAYA/VRAY/PYTHON _ fallof - occlusion shader

create a fallof and occlusion shader for Vray using python
#____________ FALLOF ____________#
def shFallof():
 # gamma node 
 cmds.shadingNode('gammaCorrect',asUtility=True, n='GammaTemp')
 cmds.setAttr('GammaTemp.gammaX', 0.455)
 cmds.setAttr('GammaTemp.gammaY', 0.455)
 cmds.setAttr('GammaTemp.gammaZ', 0.455)

 #Creates Ramp
 cmds.shadingNode('ramp', asTexture=True, n='facingRampTemp')
 # Remove middle color of ramp
 cmds.removeMultiInstance( 'facingRampTemp.colorEntryList[1]', b=True )
 #Modify Ramp
 cmds.setAttr('facingRampTemp.colorEntryList[2].color', 0,0,0, type='double3' )
 cmds.setAttr('facingRampTemp.colorEntryList[0].color', 1,1,1, type='double3' )
 cmds.setAttr('facingRampTemp.colorEntryList[2].position', 1)
 cmds.setAttr('facingRampTemp.interpolation', 1)

 #Creates Sampler Info node
 cmds.shadingNode('samplerInfo', asUtility=True, n='facingSamplerTemp')

 #Connects Ramp and Sampler
 cmds.connectAttr('facingSamplerTemp.facingRatio', 'facingRampTemp.vCoord', f=True)
 cmds.connectAttr('facingRampTemp.outColor', 'GammaTemp.value', f=True)

 # connect it to a surface shader
 cmds.shadingNode('surfaceShader', asShader=True, n='SH_TMP_Fallof')
 cmds.connectAttr('GammaTemp.outValue', 'SH_TMP_Fallof.outColor', f=True)

 # Select Ramp
 cmds.select('facingRampTemp', r=True)

 #Renames nodes so you can use the script as many times as you want
 cmds.rename('facingRampTemp', 'facingRamp_F')
 cmds.rename('facingSamplerTemp', 'facingSampler_F')
 cmds.rename('SH_TMP_Fallof', 'SH_Fallof')
 cmds.rename('GammaTemp', 'gammaCorrect_F') 

shFallof()


#____________ OCCLU ____________#
def shOcclu():
 # surface shader
 cmds.shadingNode('surfaceShader', asShader=True, n='SH_TMP_Occlu')
 cmds.shadingNode('VRayDirt', asShader=True, n='VrayDirt_TMP')
 cmds.connectAttr('VrayDirt_TMP.outColor', 'SH_TMP_Occlu.outColor', f=True)

 #Renames nodes so you can use the script as many times as you want
 cmds.rename('SH_TMP_Occlu', 'SH_Occlu')
 cmds.rename('VrayDirt_TMP', 'VrayDirt_O')

shOcclu()

MAYA _ float value annotation in viewport

Annotation node can't have float value, only string. So to display a value in viewport:
- dynamic- particles - particle tools : create one particle
- select particle shape and add a float attribute toto
- particleshape - render attribute - particle render type : numeric
- attribute name : toto
- then connect any value (like scaleX) to toto


9/21/14

MAYA/MEL _ toggle


//Toggle Isolate Selected in Current Panel
$currentPanel = `getPanel -withFocus`;
$state = `isolateSelect -q -state $currentPanel`;
if ($state == "0")
 {
    enableIsolateSelect $currentPanel 1; 
 }
else
 {
    enableIsolateSelect $currentPanel 0;
 }

// Toggle SHaded WIreframe
string $panel = `getPanel -wf`;
modelEditor -e -wos ( !`modelEditor -q -wos $panel` ) $panel; 

//ToggleOutliner:
if ( `window -exists outlinerPanel1Window` ) 
deleteUI -window outlinerPanel1Window; 
else 
tearOffPanel "Outliner" "outlinerPanel" false; 

MAYA/MEL _ second outliner


tearOffPanel "Outliner1" "outlinerPanel" false;
tearOffPanel "Outliner2" "outlinerPanel" false;

MAYA/VRAY _ linear workflow

Render and VFB settings

For texture map add a Vray texture input gamma attribute

Create a standard gray shader : Vray MTL with gamma correct node in diffuse, 0.5 value color and gamma value 0.455