Entries in crease (1)

Monday
Jun162014

Hard/Soft Edges to Edge Creasing - Maya MEL

One of the modeling workflows that I frequently apply in 3ds Max is to use Smoothing Groups to act as a poor man’s creasing. That is done by stacking two Turbosmooth modifiers on top of eachother, with the first one having Separate By Smoothing Groups on and using the Iterations to control the crease amount. 

With the introduction of Pixar’s OpenSubdivs in Maya 2015, edge creasing becomes very appealing and in a lot of cases it can be a huge time saver. One of the major drawbacks I found was that the crease values are easily destroyed when using basic modeling tools, and rebuilding them is a pain in the ass.



With the script below I am replicating the same workflow by using Hard/Soft edges to store and control the creasing of the model. It basically adds a predefined creasing value to Hard edges and removes the creasing from Soft edges. 

I run this after I define the initial Hard/Soft edges, usually with Set Normal Angle, and whenever the edge creasing gets mangled by various modeling tools. The authoring is done only by using Harden/Soften Edge, or by using the commands from the Shelf attached at the bottom. 

 

 

global proc createCrease()
{
        float $creaseValue = 3;
        ConvertSelectionToEdges;
	SelectEdgeMask;
	string $selEdges[] = `ls -sl -fl`;
        string $hardEdges[];
	polyCrease -value 0;
        select -cl;     
        int $i = 0;
        for ($edge in $selEdges)
        {
                string $edgeType[] = `polyInfo -ev $edge`;
                if (`gmatch $edgeType[0] "*Hard*"`)
                {
                        $hardEdges[$i] = $edge;
                        $i++;
                }
        }
        select $hardEdges;
        polyCrease -value $creaseValue;
        select -cl  ;
}


createCrease();

 

Notes:

 I recommend staying away from defining custom crease sets until you are done changing the topology of the model, and only worry about Hard and Soft edges. Maya’s tools are very destructive when it comes to maintaining crease values, and you will end up manually reassigning custom creases after each topology change. The default creasing value in the script is 3, so you can use safely use the H3 and Soft presets while modeling, in case you have to rebuild the creasing with the H/S script later on. These presets mark the edges as Hard/Soft at the same time

 

Please feel free to modify the scripts to your own liking!

 

Download: shelf_U_Crease.mel

To install, copy it to : Documents\maya\2015-x64\prefs\shelves