Jan 17

This is a short tutorial that will show how to take skin weights from one mesh to another mesh.You’ve worked on weighting a mesh but the uv’s are bad. You have a mesh now that has good uv’s and need to now get the weight from the bad mesh to the good mesh. This will show you how to do that.

To download the high-res video, right click this and save.

more about “Copy/Transfer Skin Weight “, posted with vodpod

 

Dec 7

Been awhile since I’ve posted anything. So I added a new script to the melscripts section.

Nudge is a useful script for fine tuning your skinning.

Usage:
Select one or more vertices to populate influence list.
Set amount you want to nudge.
Select which influence you want the vertice to nudge to.
Popup menu in influence list with 2 options to remove or fully weight to this joint.

nudge.mel

nudge

Happy nudging :)

Jul 27

Been awhile since I wrote anything Maya related so I thought I’d do a brain dump.

So right now I’m working in Maya at work for a short time. Get to work on a previz rig that has to be built from the ground up with a build system. Now I’ve written build systems and worked with them in the past but have not run into this process. The processes I’ve used in the past, the bound mesh was imported in and constrained to the animation rig. Well with this system, it will be importing a clean mesh and the joints and binding the mesh programatically. Actually this remined me that the rig is being built before building the weights. I need to flip this process.

I had to think how I wanted the scripts to create this weighting process and started looking into other scripts out there that exported/imported weight info. All the scripts I’ve come across have there own format for exporting and reading in the data. Well, I guess the easy way would to export the data with one of the scripts and use the import function in the script to rebuild back into the next maya session in the build system. However I want this to be fairly generic and be self-contained.

Now I wish I can devuldge the script but since I wrote it at work I can’t but I’ll describe the process of what I’ve done so far. So the script process each mesh selected and creates a function in an external file like “global proc weight_nameOfMesh()”. With in that function, it grabs all the joints used and the geo and binds it. Renames the skinCluster and has a bunch of skinPercent calls.  One thing I had to make sure when creating this that the weights are normalised so they equal up to 1.0 before exporting the data.  Great, so at this point the function binds the geo and rebuilds the weights however normalization is becoming an enemy. When setting the weights in a linear fashion, the verts are wanting to be normalised and there are times when the wieght doesn’t take with the skinPercent. So what needs to be done is all the weights need to on hold and set all the weights to zero then start rebuilding from the ground up. Hmm, scratch head. I guess what needs to happen is when I export the data and it builds each function and at the end of file I need to create another function that will get called in each funtion that calls this zero weights then unhold the wieghts. So at the end of this export function I have a file that contains many funtions that can be called from another function to rebuild the weights from the ground up. Basically a script that builds a script.

Example format:

global proc weights_l_foot(){

select joint1,joint2….;

select -add l_foot;

skinCluster -tsb -mi 1 -name l_foot_skinCls;

zeroOutWeights;

skinPercent -tv joint1 -v 1 l_foot_skinCls l_foot.vtx[1];

….

unholdWeights;

}

global proc zeroOutWeights(){

…..

}

global proc unholdWeights(){

…..

}

Jan 7


—>. VIDEO LINK. <—

Below is a direct link to download if you have issues viewing on your browser

File size (218 mb) Rt click -> save as…

http://snolan.net/blog/ikfkArmSetup/ikfkArmSetup.swf

  • A 45 min comprehensive tutorial on how to setup an ik/fk arm
  • How to avoid some pit falls with building an ik fk setup
  • Building simple animation controls
  • Simple blending without constraints and using the power of utility nodes
  • How to build a seamless switching script that is BUILT IN THE RIG
  • Script will work with referencing and make it so the arm will NEVER pop or float between modes

Why did I do this? Well, I see questions regrading this type of setup all over forums and I wanted to pay back the community for all the help I received when I was starting out. I hope this helps some new comers to rigging or just interested people.

Added***

I am including the final file (Should work with Maya 7.0, let me know if it does not) and the code used for making the ik fk switch.

Maya File

Mel Code for Switch

Note: You must have zooToolBox installed and the scripts installed in the correct directory. This process is explained in the video.

Dec 22

More Maya Python fun

This is in addition to what I said below but I found a little better interactive shell that ships with wxPython called PyCrust.
Go to http://wxpython.org/download.php and download the win32-ansi for Python 2.5 and the “docs and demos” too. This will get you the PyCrust. Just let everything install in default locations and say yes to compile the packages.

No goto your Programs->wxPython2.8 docs and demos->PyCrust.
You should get this.

Now lets interact with Maya.

Type:
import maya.standalone
maya.standalone.initialize(name=’python’)

As soon as you do you start to see this:

You get some nice info from Maya and using this in an external editor.

Now type:
import maya.cmds as cmds
cmds.polySphere()

You should now have auto-complete showing you the command. Pretty cool, eh?

Yea, I wish it would show the flags associated with the command.
Now this not really a full editor. It’s just an interactive shell but you could quickly proto-type something in PyCrust and port it over to your editor that is your main script. If you goto the history tab you can quickly copy/paste your chunk of code back over to your editor. This is just a great way to test something out without having to launch Maya up.

Dec 21

Maya and Python development

Not sure if many people are aware of this but it is possible to develop python scripts in Maya without having Maya open and interact with Maya. Wait…what? Yea, you can interact with Maya without having the Maya interface open. Think of it as Maya in command-line mode. But to get this to work you have to add a few things to your system environment variables. Most of this is straight from the Maya help docs but doesn’t mention about IDLE.

Rt click on My Computer and goto properties. Goto the Advanced tab and click on Environmental Variables.
Create a new System Variable.
Variable name: MAYA_LOCATION
Variable value: DRIVE:\Program Files\Autodesk\2008\
Create one more Systerm Variable.
Variable name: PYTHONPATH
Variable value: DRIVE:\Program Files\Autodesk\2008\Python\lib\site-packages

So probably the best place to test this is using IDLE that comes with Python 2.5.
So if you type the 2 lines below and save the file then run it (F5) it will startup maya in the background. Give it a sec to initialize.

Once you’ve run that you’ll have an interactive session that you can use to script with and have auto-complete help with hard to remember commands.

Remember, Maya will be running in the background as long as you have the python interpreter up and don’t run the maya.standalone twice.

Now open up a new window and import a Maya module and you’ll now have auto-complete working with Maya.

*Note*: Now remember that this is just a command-line interaction and no UI so you can’t run a script that opens up a mel cmds UI(ie. showWindow). You could however open a Tkinter window outside of Maya and have this UI interact with Maya that is running in the background. Totally doable.

Hope this is helpful and makes python development in Maya at bit more fun for ya. ;)

Feb 19

I need to be Normal!
Not me, a vertexFace. I ran into an issue last week where an artist had made user defined normals and when I began to skin the character the normals got whacked. So I needed an easy way to transfer normals from one model to another. I searched around and was surprised that I didn’t find a script that could do this. What I found was close but people were struggling on the issue that when you select a vertex and run polyNormalPerVertex -q -xyz, it returns 3 or more float numbers. Well, it’s faces that surround a vertex and there could be nth amount of faces around a vertex. So copying and pasting using just the vertex is not the right approach. It has to be the face. Then for each face, grab the vertex face. Why not just select all the vertex faces and iterate them? So, this ended up being much easier than I thought. This core proc has some use that extends it’s basic need. I’ll let you discover that.

//transfer normals across two meshes
global proc transferNormals(string $source, string $destination){

float $normal[];
string $destVtxFace;
//get the source normal info
select -r $source;
PolySelectConvert 5; //convert to vertexface
string $vtxFacesOnSource[] = `ls -sl -fl`;

//get the destination info
select -r $destination;
PolySelectConvert 5;
string $vtxFacesOnDest[] = `ls -sl -fl`;
if(`size($vtxFacesOnSource)` != `size($vtxFacesOnDest)`)
error “The number of normals from source does not match the destination”;

for($vtxFace in $vtxFacesOnSource){
//get the normal of the vertex face
$normal = `polyNormalPerVertex -q -xyz $vtxFace`;
//switch the transform
string $transfer[];
tokenize $vtxFace “.” $transfer;
//transfer it to the destination mesh
$destVtxFace = ($destination + “.” + $transfer[1]);
polyNormalPerVertex -xyz $normal[0] $normal[1] $normal[2] $destVtxFace;

//confirm the transfer
float $newNormal[] = `polyNormalPerVertex -q -xyz $destVtxFace`;
print (”Source:\t” + $vtxFace + “:” + $normal[0] + ” ” + $normal[1] + ” ” + $normal[2] + “\n”);
print (”Dest: \t” + $destVtxFace + “:” + $newNormal[0] + ” ” + $newNormal[1] + ” ” + $newNormal[2] + “\n”);

}select -r $destination;
select -cl;

}

Feb 3

jEdit Rocks!
I’ve been searching for some time a good text editor for scripting in MEL with good syntax highlighting and other useful features. I’ve used Mel Studio in the past both the free version and the Pro. However, the Pro is a tad expensive ($112) for not really that much more in features vs. the free version. Of course the benefit is that you can source and execute your code right there in Maya. The other con is that you when a new version of Maya comes out, you have to upgrade the plugin and Mel Studio is only MEL and does not yet support Maya 8.5 with the new Python integration. Now, I’m not slamming Mel Studio, it’s really nice but I as I’m trying to learn Maya API and Python, I’d have to find a new editor. I’ve been using at work and home PsPad which is also a great editor with Mel hightlighting. On to jEdit.

First off, I’ve used jEdit before when I was working on Linux and in windows. I forgot how much it has to offer and best of all it’s FREE! If you goto http://www.highend3d.com/maya/downloads/tools/syntax_scripting/ , you’ll see a good amount of highlighters and plugins available for jEdit. Most of these take some time to setup and most have instructions on how to set all the plugins. The two most useful is the CodeBrowser plugin and sendToMaya macros. Here is a shot of my jEdit UI:

If you look to the right there are three buttons I setup that are Macros. Really easy to add and you can make your own custom buttons if you wish. One will send all of the text to Maya, the second will send selected and the last one will source it in Maya. All I did was put a commandPort command into my userSetup.mel in both Maya 7.0 and my Maya 8.5 so it gets executed at startup. So, which ever one I have open, it will send the code to that one. The code is in 3 python scripts where you can change the port number and/or the mel sending script.

I also have autoComplete working so that after a few letters will pull up the name of the command in a dropdown for MEL and Maya API.

The CodeBrowser is great too. It will show global/local procs and variables in your script. If you double click a function, it will jump you to it. Sames goes for Python in Maya as well. You have to have cTags installed inorder to get this to work. The CodeBrowers will show where to get that. But, if the file is large, you may want to disable the plugin cause it may take some time to load. Of course there is a plugin for loading and unloading plugins. Very handy.
Here is a shot of that as well:

This just blows all editors out of the water and you get all this for FREE! Freakin Awesome!

Now, this takes a bit of fussing and a few things to setup. It would take me some time to explain how this is all setup but most of it comes with instructions on how to do it.

I can’t say enough about this editor. I’m really rediscovering it again and I’m anxious to start using it as my dev suite and customizing it. Plus I found a plugin for Perforce as well. If someone told me that here is an editor that does all this and it’s $150-$200 I’d buy it hands down. Did I say it was free?

Give it a whirl! Once you start using, I don’t think you’ll turn back.

http://www.jedit.org/

Happy coding!

Dec 4

Skin Slide/Bulge Demo

Ok, So I promised I’d share this little tip for having a skin slide effect but have it bone driven.

I’ve included the file so that you all can just play around with it and see how it all works so that I don’t have to go through it too much in depth. I’m feeling lazy today so you have to forgive me.

The basic premise behind it is using a lofted surface that is driven by rebuilt curves. The curves are skinned to 3 joints; one on each end of the middle and one it the middle of the curve. Then there are rivet locators that ride on top of the nurbs surface. Under each rivet is a joint that is used for skinning the poly object. Then you have to paint the poly surface as to how you want to the surface to deform from the driven nurbs surface.

There are offset controls that ride with the nurbs surface as well to give even more control. I put it all into layers so that you can turn on what is going on underneath.

Sorry for the delay. Hope you enjoy this.

I used this technique in production on a piano for the piano keys. Worked well for making it look cartoony.

Maya File:
skinSlideDemo.ma

Oct 24

quikSkins


Download

I wrote up this little UI for quickly setting paint wieght values. I really hate Maya’s current UI. It’s too big and I needed a way to set values quickly. If there is a need for a Mac version then let me know and I can make some tweaks. This is only for Windows since I use color for the controls. This is pretty bare bones and very simplified but does the job. There are popMenus for Brush Profiles under the operations label and toggling clamps under the clamp label. Hope it helps out a few. Let me know what you think.

Cheers.

« Previous Entries