View Full Version : Expression for soft/hard edges?
11-11-2003, 07:37 PM
I have a poly character that is human and I have duplicated it and remodeled the geometry into that of a dog so I can blend shape between the two. The problem is when he is in the dog shape, he has some very pronounced hard edges. I was wondering if I could attach an expression to the blend shape that would select and set all the edges of the model to soft when it reaches the dog shape, and then return them to thier previous state when set back to zero in the human shape. Something like:
If BlendShape = 0, edges = present state;
Blendshape = 1, select all edges and make soft.
I'm pretty new to expressions and I'm trying to learn, and I'm also an intern trying to impress a potential employer, so any help would be much appreciated.
11-12-2003, 01:59 PM
i really am no expert when it comes to controlling polys via MEL, because i haven't really worked much with polys, but here's a little something i found recently; it identifies the hard edges in your object.
now what you have to do is find out how to alter edgeHardness. (if you do let me know! ;) ) but since you know how to model a humanoid in such a way that you can morph it into a dog you probably know how you create hard-edges, just start from there and see what maya reports in the scripteditor.
below is a little routine that prints "hardedge <index-of-edge>: "<first-point-of-hardedge>" "second-point-of-hardedge>"
string $component , $edges , $buff ;
$edges = `polyInfo -ev`;
int $numEdges = `size $edges`;
for ($v = 0 ; $v < $numEdges ; $v++ )
// each array-element is a string; check if the string "Hard" is present
// cause only hard edges are interesting here
$component = $edges[$v] ;
$hardFound = `gmatch $component "*Hard*"` ;
// each array-element is a string; find the ";" and everything right off it
$component = `match "[^:]*$" $component`;
// the array-string returned ends with "Hard" plas a LF; strip it!
$component = `match "^[^(Hard)(\r\n)]*" $component` ;
// the string is still filled with whitespaces; tokenize, so 2 numeric elements remain
$num = `tokenize $component " " $buff` ;
print ("hardedge "+$v + ":\""+$buff+"\" \""+$buff+"\"\n") ;
11-12-2003, 11:32 PM
okay, i couldn't stop thinking about this, and i started thinking: "there is no edge-related attribute that controls hardness, it's probably to do with normals, and while i was researching "normals" i came across this:
to control smoothness of edges, see command refernence of:
polySoftEdge -a <value>
if your script remembers, which edges are "hard" you can select those and run this command:
"polySoftEdge -a 180"
to make 'em smooth
and later you pick the same edges and go:
"polySoftEdge -a 0"
to make 'em hard again.
maybe you can even animate the <value>, i don't know how that'll look in render (flicker etc) but there's a full range of new possibilities for you to try and play around with now!
11-13-2003, 04:06 PM
Hi that actually can be done using a good old SetDrivenKey, since both blend shape and polySoftEdge are node, you can drive the angle of the polySoftEdge with the blend shape..
Unless you realy want to do it in mel..
11-13-2003, 07:29 PM
thanks for your time and effort but the expression is appearing a little more complicated than I'm ready for right yet, though I just picked up MEL Scripting for Maya Animators by Wilkins and Kazmier, so hopefully soon.
Yeah, SDK worked just dandy. That idea didn't even occur to me. Thanks.
01-16-2006, 04:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.