rebb> I don't see any colorPerVertex node in Maya. Is it some form of auxiliary node that is hidden by default? Using Maya2010 at the moment. I also have 2011 available.
I actually tried at some point to manually select a couple of vertices and run the "polyColorPerVert -cal 1;" which should clamp the vertex colors. But this as far as I remember this didn't make any difference to the results exported with the SBM.
Ok I just tried with a dummy object.
First of all, if you've ever deleted history on your object (anyone confirm this?) you won't get a colorPerVertex or createColorSet node as you run the script? I couldn't find any way to get these nodes exposed or recreated on my models, only on a brand new dummy object which I had never deleted history on.
Either way, setting the clamped flags on these nodes didn't make a difference for the exported data in the SBM format.
You're right, seems these nodes are only created when the shape has some history before calculating the curvature colors.
I can put a clamp option in the next version.
Try this for a mesh that doesn't get these nodes applied :
setAttr theShape.colorSet[0].clamped 1
Replace "theShape" with your Shape-Name.
Replace the 0 with the index of the actual curvatureColor set if the mesh has more than one colorSet.
You can see the name of a colorset with "getAttr theShape.colorSet[x].colorName".
I tried setting the clamped flag with the command your posted.
It did not make a difference with the SBM-export.
I think it's since changing that flag doesn't alter the actual stored vertex colors. It's just a stored flag of some sort that is account for in certain other Maya features that use vertex colors.
The SBM exporter probably doesn't take this into account, it only reads the existing vertex color values.
Sorry for the semi-necromancy here. But I figured out a way to get the values clamped without any extra scripts/plugins if anyone is in need of it.
The r7_vertCurvature plugin won't clamp your vertex colors, so at extreme angles and/or with a high Scale value you can get color values above 1.0 rgb. In my case this was an issue since I used xNormals SBM format to export to get my files to xNormal and use the "Bake highpoly's vertex colors" to get the results to textures. Problem was, with the SBM format vertex colors above 1.0 would render as black colors.
I tried lots of stuff and noticed that if you create a new color set in Maya you can use the "clamped" flag which keeps the colors within 0.0-1.0. It doesn't seem like you can change this after a color set has been created. So here's the trick. Before running r7_vertCurvature you can create a new color set with the clamped flag, then rename it to the same name that r7_vertCurvature uses when creating a curvature color set. I'm guessing that when the plug-in tries to create this color set and it already exists it instead decides to just go ahead and use the already existing one (with clamp flag).
1) Import your highpoly (or a lower division if Maya refuses).
2) Create a new color set with clamped flag on.
3) Rename it to "curvatureColor".
4) Run the r7_vertCurvature to get the curvature colors you want.
5) Export using xNormal SBM format (enable it first in your plug-ins). Make sure to include vertex colors.
6) Set up your highpoly and lowpoly in xNormal and render the curvature data to the lowpoly's UVs using the "Bake highpoly's vertex colors". Make sure to uncheck the "ignore per-vertex-color" on your highpoly.
7) Use the curvature texture as a utility texture to get masks for your various textures.
Tile diffuse and grungemap from cgtextures. I modelled a highpoly source from the diffuse and used it for generating normals, ao and curvature. Spec as shown in image was created in photoshop with the curvature data and a grungemap.
Thanks Kodde
Thats supercool. Gonna have to incorporate as much in some tools.
I did something similar with Barycentric Coordinates to find crevices:
( from an object selection the script selects all the edges that make up crevices )
or the opposite ( depending on whether I wanted a hill or a valley ).
Do something useful to that selection like apply a dark vertex color to fake AO:
or...
shift select crevice vrts to get the inverse selection ( the hills ):
Do something useful to that selection like:
editMesh> transform component or jes normal tool ( pump up the hills )
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 .
I know this thread is kinda old, but I have a question related tot this script.
I've got a high-rez object with the vertex colours aplied for the curvature.
I am trying to bake this this to my low rez using mayas batch bake. But it's giving me a gray map, which is the material colour.
Is there anyway I can use maya's transfer map to transfer vertex colour information ?
I know there are work arounds like baking it to a texture with batch bake, or using a different program such as xnormal.
I need to do a lot of objects, so I would like to do it in maya with the transfer maps, so I can get the Normal, AO, and Curvature information all in one go with the same envelope.
Any help would be appreciated.
PS @Reb, this script is super awesome I used it a ton, on my last project the metroid character.
I found the option gave it a shot. Like anticipated this function only allows you to export the data the a texture of the geometry the vertex colour is on.
While my goal is to transfer the vertex colours from the high-res mesh to the texture of my low-res mesh. Similar to the X-normal functionally spoken off in this thread.
But I am trying to keep it all in maya to speed up the workflow.
The main drawback of your suggested method is that the high res mesh needs to have non overlapping uvs, and you first need to bake it out to a texture, creating an extra step.
Since most high-res geo exported from a sculpting package doesn't have UVs you will get the following error // Error: Failed to export the attribute map.
Hey guys
So, I'm trying to use the TC curvature shader information of polygon models and I'm a little confused. If I apply the shaders in the example scene to my models the render comes out black, Im assuming this is because they are polygon models and all the example scene uses is nurbs. The site also claims there are lots of perameters but in my shader node it has none of these. Has anyone got a good example of this shader working on a polygon model and if so whats the work flow?
From what I remember this is not a shader initially? It sets vertex color?
But I do recollect one extra feature being bake-material? Anyhow, the parameters I remember using when fiddling with this was through a custom window which would appear as you called the plugin?
**CASTS THREAD NECRO!!** (sorry guys! Had to do it...)
Does rebb's script still work in maya 2014 or have we found other/better tools to do the job? Kodde's skrewdriver top looks kickass. I'd love to generate curvature maps with that kind of quality. Any suggestions?
P.S. I already tried installing it but the plugin wont show up on my plugins list.
I think it is broken in 2014, haven't tested but reb never distubute the real code, but instead the compiled python bytecode, which is dependent on the python version.
And Maya 2014 uses python 2.7 while all earlier versions are still on python 2.6.4 or earlier.
It could likely be decompiled back to normal python code to make it work on 2014 but that is kinda shady.
I think it is broken in 2014, haven't tested but reb never distubute the real code, but instead the compiled python bytecode, which is dependent on the python version.
And Maya 2014 uses python 2.7 while all earlier versions are still on python 2.6.4 or earlier.
It could likely be decompiled back to normal python code to make it work on 2014 but that is kinda shady.
Could contact reb I guess.
Bummer! It looks so awesome. What are some other modern alternatives for curvature map baking?
Bummer! It looks so awesome. What are some other modern alternatives for curvature map baking?
Well I just use rebs tool, but knald does a good job.
Also you say you don't see it in the plugin list at all?
If it isn't working due to the pythonvversion mismatch it would still show in the plugin list, it would just fail to load.
Well I just use rebs tool, but knald does a good job.
Also you say you don't see it in the plugin list at all?
If it isn't working due to the pythonvversion mismatch it would still show in the plugin list, it would just fail to load.
Are you sure its in the right path?
The instructions say to place it within your "plug-ins" folder. But to be honest the folder structure between maya 2012 and 2014 has changed slightly, so I can't be sure of anything.
xNormal bakes curvature maps form highpoly, although it can produce lot of artifacts.
Knald height map generated from an existing normal map works pretty good as a curvature map.
I like that the r7 curvature map places convexity and concavity in separate channels but still in the same image. Then I can use them quickly as alphas for masking.
P.S. When I tried Xnormal I noticed it didn't give as good results as the ones posted here in this thread.
This seems absolutely awesome! I too have had some issues with xNormals curvature map baking.
Though, when clicking "Assign Bake-Material" i get an error reading
# Error: ValueError: file k:/Create/Maya/2014-x64/plug-ins\r7_vertCurvatureMain.py line 501: No object matches name: .cpvSets[0] #
I may have done something wrong, but I can't think of what that could be.
I have loaded MR and the r7 Vertex Curvature UI loads just fine. I am using the default settings too. The test object is a subdiv surface and I'm using the 2014 x64 version of the script on a windows machine.
Its been a few years and we have new tools in Maya so I was just wondering if there's any easy way get a curvature bake these days? Im both baking high to lowpoly and also lowpoly to itself hoping to get edge bakes to save me hand drawing lots of edges manually in photoshop.
Replies
Wonder if a min/max clamping function would be useful or not :d.
I actually tried at some point to manually select a couple of vertices and run the "polyColorPerVert -cal 1;" which should clamp the vertex colors. But this as far as I remember this didn't make any difference to the results exported with the SBM.
First of all, if you've ever deleted history on your object (anyone confirm this?) you won't get a colorPerVertex or createColorSet node as you run the script? I couldn't find any way to get these nodes exposed or recreated on my models, only on a brand new dummy object which I had never deleted history on.
Either way, setting the clamped flags on these nodes didn't make a difference for the exported data in the SBM format.
I can put a clamp option in the next version.
Try this for a mesh that doesn't get these nodes applied :
setAttr theShape.colorSet[0].clamped 1
Replace "theShape" with your Shape-Name.
Replace the 0 with the index of the actual curvatureColor set if the mesh has more than one colorSet.
You can see the name of a colorset with "getAttr theShape.colorSet[x].colorName".
It did not make a difference with the SBM-export.
I think it's since changing that flag doesn't alter the actual stored vertex colors. It's just a stored flag of some sort that is account for in certain other Maya features that use vertex colors.
The SBM exporter probably doesn't take this into account, it only reads the existing vertex color values.
Thanks! Looking forward to it.
The r7_vertCurvature plugin won't clamp your vertex colors, so at extreme angles and/or with a high Scale value you can get color values above 1.0 rgb. In my case this was an issue since I used xNormals SBM format to export to get my files to xNormal and use the "Bake highpoly's vertex colors" to get the results to textures. Problem was, with the SBM format vertex colors above 1.0 would render as black colors.
I tried lots of stuff and noticed that if you create a new color set in Maya you can use the "clamped" flag which keeps the colors within 0.0-1.0. It doesn't seem like you can change this after a color set has been created. So here's the trick. Before running r7_vertCurvature you can create a new color set with the clamped flag, then rename it to the same name that r7_vertCurvature uses when creating a curvature color set. I'm guessing that when the plug-in tries to create this color set and it already exists it instead decides to just go ahead and use the already existing one (with clamp flag).
I'm happy
1) Import your highpoly (or a lower division if Maya refuses).
2) Create a new color set with clamped flag on.
3) Rename it to "curvatureColor".
4) Run the r7_vertCurvature to get the curvature colors you want.
5) Export using xNormal SBM format (enable it first in your plug-ins). Make sure to include vertex colors.
6) Set up your highpoly and lowpoly in xNormal and render the curvature data to the lowpoly's UVs using the "Bake highpoly's vertex colors". Make sure to uncheck the "ignore per-vertex-color" on your highpoly.
7) Use the curvature texture as a utility texture to get masks for your various textures.
Tile diffuse and grungemap from cgtextures. I modelled a highpoly source from the diffuse and used it for generating normals, ao and curvature. Spec as shown in image was created in photoshop with the curvature data and a grungemap.
Thats supercool. Gonna have to incorporate as much in some tools.
I did something similar with Barycentric Coordinates to find crevices:
( from an object selection the script selects all the edges that make up crevices )
or the opposite ( depending on whether I wanted a hill or a valley ).
select object>
run script cly_hillOrValley.mel <-- to select crevices:
Do something useful to that selection like apply a dark vertex color to fake AO:
or...
shift select crevice vrts to get the inverse selection ( the hills ):
Do something useful to that selection like:
editMesh> transform component or jes normal tool ( pump up the hills )
http://www.polycount.com/forum/showthread.php?t=61998
i use it almost daily, and works fine on maya 2012 for me. Just using the latest one in this thread.
I've got a high-rez object with the vertex colours aplied for the curvature.
I am trying to bake this this to my low rez using mayas batch bake. But it's giving me a gray map, which is the material colour.
Is there anyway I can use maya's transfer map to transfer vertex colour information ?
I know there are work arounds like baking it to a texture with batch bake, or using a different program such as xnormal.
I need to do a lot of objects, so I would like to do it in maya with the transfer maps, so I can get the Normal, AO, and Curvature information all in one go with the same envelope.
Any help would be appreciated.
PS @Reb, this script is super awesome I used it a ton, on my last project the metroid character.
Thanks for your reaction.
I found the option gave it a shot. Like anticipated this function only allows you to export the data the a texture of the geometry the vertex colour is on.
While my goal is to transfer the vertex colours from the high-res mesh to the texture of my low-res mesh. Similar to the X-normal functionally spoken off in this thread.
But I am trying to keep it all in maya to speed up the workflow.
The main drawback of your suggested method is that the high res mesh needs to have non overlapping uvs, and you first need to bake it out to a texture, creating an extra step.
Since most high-res geo exported from a sculpting package doesn't have UVs you will get the following error // Error: Failed to export the attribute map.
So, I'm trying to use the TC curvature shader information of polygon models and I'm a little confused. If I apply the shaders in the example scene to my models the render comes out black, Im assuming this is because they are polygon models and all the example scene uses is nurbs. The site also claims there are lots of perameters but in my shader node it has none of these. Has anyone got a good example of this shader working on a polygon model and if so whats the work flow?
But I do recollect one extra feature being bake-material? Anyhow, the parameters I remember using when fiddling with this was through a custom window which would appear as you called the plugin?
Does rebb's script still work in maya 2014 or have we found other/better tools to do the job? Kodde's skrewdriver top looks kickass. I'd love to generate curvature maps with that kind of quality. Any suggestions?
P.S. I already tried installing it but the plugin wont show up on my plugins list.
And Maya 2014 uses python 2.7 while all earlier versions are still on python 2.6.4 or earlier.
It could likely be decompiled back to normal python code to make it work on 2014 but that is kinda shady.
Could contact reb I guess.
Bummer! It looks so awesome. What are some other modern alternatives for curvature map baking?
Knald height map generated from an existing normal map works pretty good as a curvature map.
Well I just use rebs tool, but knald does a good job.
Also you say you don't see it in the plugin list at all?
If it isn't working due to the pythonvversion mismatch it would still show in the plugin list, it would just fail to load.
Are you sure its in the right path?
The instructions say to place it within your "plug-ins" folder. But to be honest the folder structure between maya 2012 and 2014 has changed slightly, so I can't be sure of anything.
I like that the r7 curvature map places convexity and concavity in separate channels but still in the same image. Then I can use them quickly as alphas for masking.
P.S. When I tried Xnormal I noticed it didn't give as good results as the ones posted here in this thread.
There's an updated version here .
Be aware that it has a bunch of changes that break 1:1 compatibility with the old version. Mainly things like parameters, color output etc.
Wow thanks! I'll have to try this out ASAP.
Though, when clicking "Assign Bake-Material" i get an error reading
# Error: ValueError: file k:/Create/Maya/2014-x64/plug-ins\r7_vertCurvatureMain.py line 501: No object matches name: .cpvSets[0] #
I may have done something wrong, but I can't think of what that could be.
I have loaded MR and the r7 Vertex Curvature UI loads just fine. I am using the default settings too. The test object is a subdiv surface and I'm using the 2014 x64 version of the script on a windows machine.
Any ideas would be much appreciated! Thanks!
Do you have this plugin for Maya 2014 AND Maya 2015?
Im working on both versions and I cant run the Python to make some tests.