12/12/14

MAYA / VRAY _ wave with distanceTex node


To procedurally create wave near object :
- create a VRayDistanceTex, a ramp and a shader.
- add object to distTex_set
- set the ramp like below.
- connect VRayDistanceTex.outColorR to ramp.Vcoord
- connect ramp to shader diffuse.

As it's heavy to calculate, it's better to bake it to a texture file map before rendering a long animation.



12/11/14

MAYA _ can't do planar mapping uv / OBJ group problem

Sometimes, there is some buggy mesh on which Maya can't apply a planar mapping and when trying to export and import obj to clean the mesh we get this warning :
"Your OBJ file contains faces shared by multiple groups. Maya cannot create multiple objects for this file. A single mesh object will be created instead. The OBJ group information will be captured in Maya sets."

Here is a trick (for multiple objects) :
export to OBJ turning groups and point groups option off then import it in Maya then mesh > separate.



12/10/14

MAYA _ same uv square size multiple mesh

In UV texture editor : polygons > layout  and set "Prescale" to "World".
maya help

12/1/14

MAYA _ Particle

Volume noise fitting particle 
http://www.djx.com.au/blog/2008/07/21/particlesamplerinfo-smoke/

See the particule after converting to mesh :
nParticleShape > attribute editor > object display > unchek intermediate object
When converted to mesh increse the max triangle resolution

Delete particule with an uniform field : https://www.youtube.com/watch?v=fZWa43u8KB4
create an uniform field, set lifespan > lifespanPP only, add expression before dynamics in lifespanPP
if(nParticle_verreShape.inputForce[0] >= 0.0001)
{nParticle_verreShape.lifespanPP = 0.0;}

Multiple emitters for same nParticuleShape :
Select nParticle, shift select emitter > nParticule > Use selected emitter
or
duplicate emitter using CTRL+d then Window -> Relationship Editors -> Dynamic Relationships, select the particles in the left side of the window, check Emitters in the upper part of the right window, and select both emitters. source

Change particule color with age - Vray
Add Vray per particle attribute export to nParticleShape.
Scroll down to extra attribute and check "age".
Assign a shader with a U ramp in diffuse (delete the placement node of the ramp) to the particle.
Create a particleSampler node and connect to ramp : particlesampler.age -> ramp.uCoord.

Randomize particule color - Vray
Add user scaler 1pp attribute to nParticleSHape
add runtime before dynamics expression to it : nParticleShape.userScalar1PP = rand(1);
Add Vray per particle attribute export to nParticleShape.
Scroll down to extra attribute and check "userScalar1PP"
Assign a shader with a U ramp in diffuse (delete the placement node of the ramp) to the particle.
Create a particleSampler node and connect to ramp : particlesampler.userScalar1PP -> ramp.uCoord.

Sprite
For simple setup use nParticles -> sprite Wizard.
For sequence file texture without spriteWizard in file node animate image number and check interactive sequence caching.
if random on birth, create spriteNumPP et expression nParticleShape1.spriteNumPP = int(rand(1,4));
For scale add dynamic attribute sprite scaleX PP and spritescale Y PP, right click and create ramp
For random rotate add attribute sprite twist PP and add creation expression nParticleShape1.spriteTwistPP = rand(-180,180);
pour animer rotation dans runtime expression :
nParticleShape1.spriteTwistPP += 1;

Display age (or other attribute) in viewport
particleShape -> shading -> numeric
attribute name : age
attribute name list

Move bad particle to hide them (dirty way)
Select individual particle (right click -> particle) then add a cluster to them and move the cluster !

http://www.tokeru.com/mayawiki/index.php?title=Particles

Steppy movement (ex : when attach emitter to motion path)
Create cache : evaluate every 0.2  and save every 5 and change the subframe in nucleus if needed.

11/28/14

MAYA _ surface attach/rivet

To create a locator that follow a face, in plugin manager load muscle, select two edges on your mesh, then :
Animation > Muscle > Bonus Rigging > Surface Attach

or use a follicule
vimeo.com/47456885

11/20/14

AFTER EFFECTS _ tips

 To launch a second instance of After effects :
"C:\Program Files\Adobe\Adobe After Effects CC 2015.3\Support Files\AfterFX.exe" -m
type it in cmd (windows) or save it in a .bat file and double click.


Shortcuts

b / n  work area end / start
- / =   zoom in/out timeline
ctrl shift h  Toggle Layer Controls in viewport
shift F4  toggle parent column
F4   toggle column
ctrl a   select all
ctrl shift a / F2  deselect all
ctrl L  lock layer
ctrl shift t   open effect panel for selected layer
ctrl shift p   open dialog box for position of selected layer
ctrl+   increase scale selected layer
ctrl-  decrease scale selected layer
shift F3  toggle graph editor/layer mode
ctrl shift d   split layer according time position
shift + / shift -   change blending mode
[    in point(start) of the layer
]  out point (end) of the layer
Alt Ctrl Shift Split the frame containing the active viewer and create a new  locked viewer
x focus selected layer
Ctrl+Alt+B Set work area to duration of selected layers 
Shift+Esc Toggle between two recent composition
 Ctrl+Alt+U To choose which layer controls to show in a view, shortcut for :  choose View > View Options
Alt+Shift+M Set key on mask path for selected layer
Toggle waveform on timeline

To manually edit/add shortcuts, edit the .txt file located here:
C:\Users\UserName\AppData\Roaming\Adobe\After Effects\*.*\Adobe After Effects *.* Shortcuts.txt
- "ToggleTabPanelMaximize" = "(RParen)"
-  "TimeTrimIn" = "(Ctrl+Alt+Shift+I)"
- "TimeTrimOut" = "(Ctrl+Alt+Shift+O)"
- for azerty keyboard, add "Pad" before numbers ex : 1 -> Pad1

Easy crop comp : select region of interest then composition - crop comp to region of interest
Preserve underlying transparency (small T check) = clipping mask in Photoshop
ctrl + double click pan behind tool = pivot to center

Some expressions
loopOut(type = "continue");
loopOut(type = "cycle", numKeyframes = 2)
loopOut(type = "pingpong", numKeyframes = 2)
loopOut(type = "offset", numKeyframes = 2)

# force fps animation
posterizeTime(8);
value

# round value
Math.round(effect("Slider Control")("Slider")) 
# keep only one decimal
effect("Slider Control")("Slider").value.toFixed(1)

#copy animation from layer and offset time
thisComp.layer(1).position.valueAtTime(time-1)

11/16/14

MAYA / MEL _ flat shaded viewport

edit : Now in Maya 2015 there is an option for that in the viewport -> lighting -> use flat lighting.

I didn't find a simple way to display a flat shaded viewport. So here is a simple script to toggle the viewport with a flat shaded view, usefull to see silouhette when animating. This mel script create a global render layer with a surface shader material override, to change the flat color just modify the surface shader.
// TOGGLE FLAT - using render layer
global proc toggleFlat ()
{
 if (`editRenderLayerGlobals -q -currentRenderLayer` == "defaultRenderLayer")
 { 
  // Check if Render Layer FLat exists or create it
  if (`objExists "RL_FLAT"`)
  {
   editRenderLayerGlobals -currentRenderLayer RL_FLAT;
  }
  else
  {
   createRenderLayer -n "RL_FLAT" -number 1 -makeCurrent -global;

   // SHADER ///
   string $shadName = "SH_FLAT";
   // Check if Shader doesn't exists and create it
   if (!`objExists $shadName`)
   {
    $shader = `shadingNode -n $shadName -asShader surfaceShader`;
    setAttr ($shader + ".outColor") -type double3 0.7 0.7 0.7; 
   } 

   hookShaderOverride("RL_FLAT", "", "SH_FLAT");
   editRenderLayerGlobals -currentRenderLayer RL_FLAT;
  }
  headsUpMessage "FLAT ON";
 }
 else
 {
  editRenderLayerGlobals -currentRenderLayer defaultRenderLayer;
  headsUpMessage "FLAT OFF";
 }
 
}

toggleFlat ();

11/3/14

NUKE _ $gui

- keep subdivision of 3D objects low in GUI, high in render ($gui?10:100)
- keep motion blur sampling low in GUI, high in render ($gui?3:20)
-"$gui" in expressions will return 1 in the UI and 0 at render time. Great for enabling nodes only when rendering on the farm (use it in the disable knob or Switch node).

source

11/2/14

NUKE/PYTHON _ toggle fullscreen viewer

def FullscreenViewer():
 m = nuke.menu( 'Viewer' ).findItem( 'Toolbars/Bottom' )
 m.invoke()
 m = nuke.menu( 'Viewer' ).findItem( 'Toolbars/Top' )
 m.invoke()

11/1/14

NUKE _ find shortcut .py file

Edit shortcut without using menu.py
edit : nukeinstaldir\plugins\nukescripts\toolbars.py

10/9/14

MAYA _ Wire deformer rotation issue

When using a wire deformer with clusters there is rotation/twisting issue, to avoid :
- parent clusters, baseWire and Geo to the same controller

source

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