I saw this somewhere and I was wondering if someone knows the same script for maya. Would be really appreciated.
http://www.neilblevins.com/cg_education/vertex_map_wear/vertex_map_wear.htm
This would do the darkening of the edges by angle or convexity of the mesh.
Probably we can call it as a convexity map as Xnormal does? But I would like to know if anyone knows a script of this for maya?
Replies
*per edge in the mesh get its connected faces
*find the angle between the faces. acos(faceNormal_1faceNormal_2)
*if the angle is between a low and high value then collect the edges verts
once you've processed all the edges colour the verts
Ideally I'd like to do a full surface-curvature to vertex color script, but that'd probably be intensely slow in MEL and better to do as a plug-in. Might be time to dust off Visual Studio again...
Here's what the current output looks like.
It's in WIP state, and has some quirks related to undo ( also doesn't support undo in this state ), but if you really need it i can send you a .pyc or drop it online.
The little dark splotches come from the raw output of the current algorithm, smoothing the vertex-color once or twice helps that tho.
Its just baked to a sphere thats why the ears are being sampled strangely.
The one labeled as worn map assigns a vertex color based on edge vertex angles. A gradient material with the 3rd UV channel (color channel) is used to get more fine control in the material which can then be baked into a material or used as a mask.
I am working on another script that converts a texture back to vertex colors so one can create complex materials that blend or mix in the vertex colors as a input.
renderhjs: Nice overview too.
It has different .pyc files for different Maya Versions ( 2009-2011 ), copy them into your script folder and load up the .py file.
There's also some basic instruction inside the .py .
@fletch :
Looking at the Pits&Peaks Script renderhjs mentioned, it works pretty similar to that.
@Mop :
Thx
Edit :
Updated Version available here .
Edit: Just tried on a more heavy-duty test case, this time a 350,000 triangle decimated mesh from ZBrush.
It took just over 90 seconds to calculate, which isn't too bad. I think the results would be better if the mesh wasn't run through decimation master, but obviously it'd take a lot longer to process. After doing Smooth a couple of times on the result I think it'd be good for most uses anyway.
My next step is to try hooking this up into a shading network to control material parameters through the red/green vertexcolor channels
Shame that Maya makes working with vertexcolor in Mental Ray such a total bitch.
The next version should be a little faster as the algorithm is simplified some, also with undo support. The problem with undo support tho is that it will add some extra memory useage for each time the command is invoked ( because Maya has to hold the undo information ), but it should only be something to look out for with high vertex-count meshes.
This however looks great as a base map to bake! Mop, did you manage to bake this to texture successfully ?
Also, I checked and the Maya 2009 script works in Maya 2008 too
concave map = areas where dust and dirt might settle
convexity map = exposed areas that might be damaged/worn-out more.
http://wiki.polycount.com/Curvature%20Map
http://www.tomcowland.com/mentalray/tc_curvature/index.html
it supports tesselation with barycentric interpolation which results into smoother results if you want to bake or render stuff into bitmaps.
Different but also nice:
http://www.rpmanager.com/plugins/TensionMod.htm
(to bad its just max and plugin only)
i guess it can be useful for modeling
detecting bumps and so far
Rendering>Render Surface Map.
it's cool if you put it in textools.
I wish there was a way to generate normal maps that fast as well
renderhjs: you might want to put a spinner for distance into your MR AO Baking option. MR AO is pretty useless without it. You tend to get a lot of unwanted shadowing in the AO without it.
Thanks =D
Does it not open for you or give you error messages ?
http://i10.photobucket.com/albums/a110/RdmLegend/test-1.jpg
When I run it i get this error.
# Error: name 'r7_vertCurvature' is not defined
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# NameError: name 'r7_vertCurvature' is not defined #
much better default results now, update to be expected soon
Looks like you are trying to import the .pyc file. Instead you should copy both the .py and the .pyc file preferably into your script directory ( depending on your Maya Version, from the respective 20xx directory in the .zip ), then import the .py file and run that - it will automatically use the contents of the .pyc file.
I'm thinking maybe I'm using a different version of python?
import r7_vertCurvature.py
# Error: Bad magic number in C:/Users/kgia1/Documents/maya/2009/scripts\r7_vertCurvature_main.pyc
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# File "C:/Users/kgia1/Documents/maya/2009/scripts\r7_vertCurvature.py", line 14, in <module>
# from r7_vertCurvature_main import *
# ImportError: Bad magic number in C:/Users/kgia1/Documents/maya/2009/scripts\r7_vertCurvature_main.pyc #
It runs but I get nothing..I select my mesh type import r7_vertCurvature it runs but there's no error or anything.
Yeah it looks like you have a newer Python overriding the one that comes with Maya2009.
Try setting the "PYTHONPATH" value inside the Maya2009 Maya.env file to "<YourMaya2009Directory>\Python" first.
@haiddasalami :
Yep that doesn't work.
Either load up the r7_vertCurvature.py using the script-editor in Maya and run the contents, or load it via "from r7_vertCurvature import *".
After that you can use the "r7_vertCurvature()" Python command on a mesh.
r7_vertCurvature()
# Error: NameError: name 'r7_vertCurvature' is not defined #
Did you do what i told haiddasalami ?
Anyway, i'll put a proper readme in the package next time, sorry for that .
I used the Paint Vertex Color tool and used the export feature. But I'm lacking options such as fill texture seams with this method.
I hope it makes sense.
Btw did you try the Maya.env PYTHONPATH approach ?
No I remember fiddling with updating python on that specific computer which I had the bad magic number error on. So I uninstalled the newer version of python and that did the trick.
It's now an actual Command-Plugin that supports Undo.
This also means that Maya now treats it more like a MEL Command, and it should mainly be used in this way, altho its still possible to invoke it through Python, just slightly differently.
Other additions are a proper readme.txt, a UI Interface that pops up when using the Command without Parameters, some Algorithm changes, an newer Algorithm that should produce less artifacts on certain vertices, etc.
Changes are more accurately listed in the readme .
Grab it here .
Just shout if any problems crop up.
Edit : Oh and better delete the files from the older Version in case you had that installed, just to be sure.
Gonna give it a go tomorrow at work
Thanks.
Found a confusing typo/error in the readme I think.
That sentance says you should place the readme.txt and the r7_vertCurvature_main.pyc in your plug-ins directory. I assumed that the "this file" actually referred to the r7_vertCurvatureCmd.py" instead since this text might had been copy pasted from there at some point.
Oh, oops. Yeah you assume correctly, i wrote the text in the r7_vertCurvatureCmd.py originally, and then copied it into readme.txt.
I'll update the .zip with less confusion, thanks
Any chance we can get a clamp feature? The script writes color values outside of the 0.0-1.0 range. This is giving me some serious headache. Trying to use it together with xNormal and it's SBM format for Maya. But I get artifacts due to this.
Thanks