rmbfacetool_v0.2.10_1

21
rmbToolWin Version 0.2.10_1 8 August 2014 Page 1 of 21 rmbToolWin Version 0.2.10_1 An overly complicated MEL script to mangle geometries Background I’m interested in generative modeling, polyhedra, etc. Recent projects in Autodesk Maya 2013+ had me want to explore and develop a few tools to perform somewhat esoteric (but not necessarily unique) functions. Why not consolidate some this for public use? After all, I’ve learned and used so much from the work of others. I am relatively new to Maya MEL & Python development; use these tools at your own risk ;) Overview This tool is a single large MEL script that can be executed from a Maya script panel, a shelf button, etc. Simply load/source the script (“rmbToolWin_v0.2.10_1.mel” or “rmbToolWin.mel”). If the code is loaded and the GUI window does not appear, try running the following command from a MEL prompt: rmbMainWinUI; NOTE: Save a copy of this script somewhere within your Maya script search path as “rmbToolWin.mel” (no version) so that it can be sourced by a scriptNode (used in “Loft PolyFaces” tool). If you don’t, such nodes may generate an error when a scene is opened. If you reopen a scene with one of these scriptNodes, it will try to load “rmbToolWin.mel” which may cause the GUI to appear. The Tools Within this bloated script are a number of tools, each with its own tab within the GUI window (“rmbToolWin”). Loft PolyFaces This first tool uses curve profiles on polygon mesh faces to create lofted surfaces, offset surfaces, and simple tube extrusions. Select any polygon mesh and/or individual faces, tweak the multitude of confusion options and the quasiuseable control envelopes, the “Apply”. Be warned that this tool is not intended for large numbers of polygon faces; I recommend processing no more than 50100 faces at a time. Obviously performance will vary. Select polygon objects and/or individual polyfaces to begin. Make sure face normal are the way you want them or you may find inverted results. First and foremost, this tool traces individual polyfaces with a number of curve profiles then lofts these together and/or creates path/tube extrusions. These new surfaces can then be offset, deformed, and finally tessellated. Control envelopes are used to define curve profiles, deformation envelopes (from face edge to center), and extrusions.

Upload: quang-cao-trang-nhat

Post on 12-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  1  of  21  

rmbToolWin  Version  0.2.10_1  

 An  overly  complicated  MEL  script  to  mangle  geometries  

Background  

I’m  interested  in  generative  modeling,  polyhedra,  etc.    Recent  projects  in  Autodesk  Maya  2013+  had  me  want  to  explore  and  develop  a  few  tools  to  perform  somewhat  esoteric  (but  not  necessarily  unique)  functions.    Why  not  consolidate  some  this  for  public  use?    After  all,  I’ve  learned  and  used  so  much  from  the  work  of  others.    I  am  relatively  new  to  Maya  MEL  &  Python  development;  use  these  tools  at  your  own  risk  ;-­‐)  

Overview  

This  tool  is  a  single  large  MEL  script  that  can  be  executed  from  a  Maya  script  panel,  a  shelf  button,  etc.    Simply  load/source  the  script  (“rmbToolWin_v0.2.10_1.mel”  or  “rmbToolWin.mel”).    If  the  code  is  loaded  and  the  GUI  window  does  not  appear,  try  running  the  following  command  from  a  MEL  prompt:    

rmbMainWinUI;    NOTE:    Save  a  copy  of  this  script  somewhere  within  your  Maya  script  search  path  as  “rmbToolWin.mel”  (no  version)  so  that  it  can  be  sourced  by  a  scriptNode  (used  in  “Loft  PolyFaces”  tool).    If  you  don’t,  such  nodes  may  generate  an  error  when  a  scene  is  opened.    If  you  reopen  a  scene  with  one  of  these  scriptNodes,  it  will  try  to  load  “rmbToolWin.mel”  which  may  cause  the  GUI  to  appear.  

The  Tools  

Within  this  bloated  script  are  a  number  of  tools,  each  with  its  own  tab  within  the  GUI  window  (“rmbToolWin”).  

Loft  PolyFaces  

This  first  tool  uses  curve  profiles  on  polygon  mesh  faces  to  create  lofted  surfaces,  offset  surfaces,  and  simple  tube  extrusions.    Select  any  polygon  mesh  and/or  individual  faces,  tweak  the  multitude  of  confusion  options  and  the  quasi-­‐useable  control  envelopes,  the  “Apply”.    Be  warned  that  this  tool  is  not  intended  for  large  numbers  of  polygon  faces;  I  recommend  processing  no  more  than  50-­‐100  faces  at  a  time.    Obviously  performance  will  vary.    Select  polygon  objects  and/or  individual  polyfaces  to  begin.    Make  sure  face  normal  are  the  way  you  want  them  or  you  may  find  inverted  results.    First  and  foremost,  this  tool  traces  individual  polyfaces  with  a  number  of  curve  profiles  then  lofts  these  together  and/or  creates  path/tube  extrusions.    These  new  surfaces  can  then  be  offset,  deformed,  and  finally  tessellated.    Control  envelopes  are  used  to  define  curve  profiles,  deformation  envelopes  (from  face  edge  to  center),  and  extrusions.    

Page 2: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  2  of  21  

   Here’s  a  simple  polygon  to  start  with.    

Page 3: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  3  of  21  

   Note  that  “use  cluster  env”  and  “move  cluster”  are  enabled.    The  face  curve  profile  envelope  will  create  various  curves  at  the  relative  parametric  distance  between  the  face  edge  and  its  center.    The  cluster  envelope  will  deform  the  resulting  loft(s)  with  its  dedicated  envelope.    

Page 4: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  4  of  21  

   And  the  result…  

   

Page 5: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  5  of  21  

 I’ve  re-­‐worked  this  version  to  allow  cluster  deformation  editing  after  creation.    Click  “enable  update”  to  refresh.    

   And  voila…    

   

Page 6: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  6  of  21  

   This  tool  can  get  pretty  crazy  and  sometimes  very  interesting  results  just  happen.    Be  careful  not  to  process  to  much  at  once!    

Surface  Tiles  

This  second  tool  encapsulates  my  first  MEL  public  script  “rmbTileTool”.  As  the  name  implies,  this  tool  will  tile  arbitrary  geometry  on  a  NURBS  surface  or  in  between  two  NURBS  surfaces.    This  tool’s  methodology  was  inspired  and  derived  primarily  from  tutorials  by  Christopher  Whitelaw  (thank  you!).    

Page 7: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  7  of  21  

   

Cover  Surface  

This  tool  will  plot  various  node  types  onto  NURBS  surfaces  and/or  curves  and  attempt  to  cover/fill  them  completely.    An  effort  was  made  to  avoid  overlapping  or  duplicate  surface  plots  but  no  de-­‐duping  or  collision/overlap  detection  is  actually  performed  (at  least  not   yet).     This   tool  will   try   to   honor   trimmed   surfaces   but   I   currently   lack   sufficient   understanding   of   the  Maya  underworld   to  guarantee   consistent   results.     For   best   results,   I   recommend   using   surfaces/curves   with   at   least   two   spans   and   “rational”  parameterization.    There  is  now  a  radial  plot  mode  that  remains  a  bit  buggy  and  is  a  huge  performance  hog  –  you  are  warned!!    

Page 8: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  8  of  21  

   Here’s  a  trimmed  surface  plotted  with  nParticles.    

   

Page 9: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  9  of  21  

Expression  Ramps  

This  tool  is  my  attempt  to  allow  a  mini-­‐animation  curve  (the  envelope  of  a  remap  node)  to  be  triggered  by  an  input  signal  and  drive  other  attributes.    An  animation  expression  is  evaluated  every  time/frame  interval  to  measure/modulate  inputs  and  remap  outputs.    There  are  other  features  in  the  code  that  have  not  yet  been  worked  into  the  GUI,  such  as  converting  an  existing  animation  curve  into  envelope  ramp  values.    For  now,  some  manual  attribute  connections  are  required  to  make  it  work.    

   To  create  an  expression  ramp,  select  a  destination  node,  attribute  then  click  “select”.    This  interface  will  be  radically  re-­‐worked  in  the  near  future…    

Page 10: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  10  of  21  

   Here  are  the  main  control  attributes  for  the  expression  ramp  animation…    Adjust  trigger  threshold  and  hold  frames  to  reduce  spastic  retriggering  with  a  “busy”  input  trigger  connection  (like  from  an  audio  node  output).    

Page 11: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  11  of  21  

   The  expression  ramp  makes  use  of  a  remap  node.    The  envelope  shape  will  be  used  as  a  sort  of  dynamically  triggered  animation  curve.    Some  day,  I  will  stream  line  all  the  attributes  and  interconnects  used  and  allow  one  to  “import”  a  real  animation  curve/graph  with  variable  length  and  value  offsets...    For  now,  the  “length”  of  the  animation  is  determined  by  “frame  interval  size”  and  “envelope  length”  (see  above).    

Page 12: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  12  of  21  

   Previously,  I  can  connected  an  audio  node  output  to  the  “clustEnv”  (deformation  envelope  depth)  attribute  on  a  cluster  remap  node.    We  must  disconnect  this  so  we  can  insert  the  expression  ramp.    

   

Page 13: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  13  of  21  

Here,  I  reconnect  the  audio  node  output  to  the  “trigIn”  (trigger  input)  on  the  expression  ramp  node.    

     Finally,  connect  “mOut”  (multiplied  output)  to  the  desired  destination  –  in  this  case,  the  “clustEnv”  cluster  remap  node  attribute  so  I  can  drive  the  deformation  envelope  depth  with  the  expression  ramp…    which  is  now  triggered  by  audio  ;-­‐)    

Page 14: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  14  of  21  

   

Offset  Surface  

Similar  to  other  offset  tools,  this  one  also  permits  auto  offset  lofting  (with  optional  bevel).    

Page 15: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  15  of  21  

   Here,  I’ve  selected  a  trimmed  surface,  designated  a  bevel  offset  with  a  slight  rounding.    

   And  the  results…    

Page 16: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  16  of  21  

   

Offset  Tubes  

There  are  many  tools  that  create  tubes  out  of  curves,  etc.,  but  this  one  attempts  to  offset  a  copy  of  the  source  curve(s),  normal  to  the  curve  (a  best-­‐effort  hack  ;-­‐),  then  create  connecting  columns  between  at  each  non-­‐overlapping  edit  point.    By  default,  some  history  is  preserved  so  you  can  tweak  tube  radius  later.    Unfortunately,  the  columns  have  no  working  length  history/control  yet.    

Page 17: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  17  of  21  

   Select  curves  and  tweak  the  settings.    

   Here’s  a  zoom  in  on  the  results…    

Page 18: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  18  of  21  

   

Surface  Tubes  

This  tool  will  create  circular  profile  tubes  on  all  surface  spans  and  edges.    If  you  choose  multiple  surfaces  (with  same  spans/CVs  –  like  an  offset  surface),  tubes  will  also  be  created  between  matching  edit  points  through  all  surfaces,  in  the  order  they  are  selected.    Think  of  this  function  as  a  sort  of  nested  cage  generator.    

   

Page 19: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  19  of  21  

Ngons  

This  tool  will  generate  a  grid  of  regular  polygons  (3-­‐10  points).    Optionally,  it  will  place  them  on  selected  NURBS  surfaces  (if  “on  surface”  is  also  enabled).    Most  options  should  be  clear  but  some  are  not  fully  functional  (history  and  grid  offset/rotations).    The  default  will  create  a  10x10  hexgon  grid.    

   Here’s  part  of  the  default  hexagon  grid.    Note  the  fillets  and  spacing…    

 

Page 20: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  20  of  21  

 

Surface  Curve  Map  

This  tool  maps  curves  (or  curves  on  surfaces)  onto  another  surface.    Currently,  surface  seam  wrap-­‐around  is  not  supported.    To  map  regular  curves,  you  will  need  to  also  designate  an  object  to  use  as  a  bounding  box  reference.    If  the  source  curves  are  grouped,  you  can  just  use  the  group  as  this  reference;  all  curves  must  be  within  the  reference  bounding  box  for  parametric  mapping  to  work.    Note  that  this  tool  expects  Y  as  the  up  axis.    

 For  an  example,  I’ve  selected  a  group  of  hexagon  curves,  used  it’s  group  as  the  bounding  box  reference,  and  targeted  a  cylinder  surface.    

Page 21: rmbFaceTool_v0.2.10_1

rmbToolWin  Version  0.2.10_1   8  August  2014    

Page  21  of  21  

   And  the  result…