PDA

View Full Version : Worn Edges script (based upon Neil Blevins ideas)

 XianPalintir12-11-2010, 02:34 PMHi there!! Well, I did this script for Maya. I first did it in MEL and then translate it to Python just as a basic exercise. DOWNLOAD: http://www.creativecrash.com/maya/downloads/scripts-plugins/texturing/c/cgx_wornedges http://forums.cgsociety.org/attachment.php?attachmentid=158416&stc=1 Basically this paints hard edges (like the corners of your objects), in a user defined threshold, using Vertex Paint. Look for the Help in the script to get a lot more info about it. Script based upon Neil Blevins' (http://www.neilblevins.com (http://www.neilblevins.com/cg_education/vertex_map_wear/vertex_map_wear.htm)): Worn Edges Using A Distorted Vertex Map and his DVD for The Gnomon Workshop. Hope this will be useful. C&C welcome!! UPDATE(18-12-2010): I got more feedback than I expected and worked on the script (I didn't expect any feedback to be honest, haha). There are a couple to do's pending. UPDATE(19-12-2010): Added a new option that creates a Maya Set containing the vertices used by the script. This will allow you to do things like growing or shrinking the resulting vertex map using Maya's vertex painting and selection tools. Also, cleaned up the code a little bit. UPDATE(20-12-2010): Uploaded the wrong version yesterday, sorry for that.
XianPalintir
12-11-2010, 02:37 PM
A workmate asked me how I found the angle between the vectors (which is the most important process of the cgx_wornEdges script) so that he could apply the same technique in other software. The truth is that in the Maya script I used an specific MEL function but this angle can be found using some Linear Algebra.

So I did another script that does all this mathematic for you an this time is just pure Python, which means you can use it in any other soft that works with Python.

Basically, you have to call the script passing two arguments (the two vectors) and it will return the resulting angle in degrees.

I left four lines of code that you can uncomment if you want to test how this works.

Hope this will be useful too