Hey guys, just wanted to know what was the status on supporting multiple UV Sets via the maya plug in? I know this was mentioned previously in the sidefx labs forum (and could really use it right about now )
thank you!
Multiple UV sets status
8547 16 2- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
Sadly no. I'm guessing you want multiple UV sets for outputting? The input case would actually be fairly easy to do, but outputting multiple UV sets has the same issue as outputting multiple color sets. Each additional UV set requires additional nodes and connections to be inserted between the asset node and the mesh node. The framework right now doesn't allow that, so quite a bit of changes need to be made.
Andrew / アンドリュー
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- cklosters
- Member
- 224 posts
- Joined: Nov. 2008
- Offline
I found a relatively easy work-around to add support for multiple uv sets.
This functionality won't be available in pre 2015 versions of Maya but the function:
MFnMesh::createUVSetDataMeshWithName uses blind data to add extra uv sets to the mesh data block.
It's a bit obscure and not well documented (actually, no documentation can be found) but is available in the Maya API and does create extra uv sets. The traditional method will indeed return an error.
Example: https://github.com/applezhao/appleMayaCache/blob/master/cacheImport/0128/cacheImport.cpp [github.com]
this worked in my case:
// Create extra uv set
MString name(“AAAAA”);
MString new_name = meshFn.createUVSetDataMeshWithName(name, &status);
meshFn.setCurrentUVSetName(new_name);
meshFn.setUVs(u_data,v_data,&new_name);
meshFn.assignUVs(face_counts, vert_indices, &new_name);
This functionality won't be available in pre 2015 versions of Maya but the function:
MFnMesh::createUVSetDataMeshWithName uses blind data to add extra uv sets to the mesh data block.
It's a bit obscure and not well documented (actually, no documentation can be found) but is available in the Maya API and does create extra uv sets. The traditional method will indeed return an error.
Example: https://github.com/applezhao/appleMayaCache/blob/master/cacheImport/0128/cacheImport.cpp [github.com]
this worked in my case:
// Create extra uv set
MString name(“AAAAA”);
MString new_name = meshFn.createUVSetDataMeshWithName(name, &status);
meshFn.setCurrentUVSetName(new_name);
meshFn.setUVs(u_data,v_data,&new_name);
meshFn.assignUVs(face_counts, vert_indices, &new_name);
Senior Technical Artist Guerrilla Games
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- cklosters
- Member
- 224 posts
- Joined: Nov. 2008
- Offline
No worries,
Appears that the feature was introduced a long time ago but never documented:
http://download.autodesk.com/us/maya/docs/Maya85/wwhelp/wwhimpl/common/html/wwhelp.htm?context=WhatsNew&file=API.html [download.autodesk.com]
Just finished implementing the code and we're now able to import any amount of uv maps.
Andrew, if you'd like to take a look at the code / change, lmk.
Appears that the feature was introduced a long time ago but never documented:
http://download.autodesk.com/us/maya/docs/Maya85/wwhelp/wwhimpl/common/html/wwhelp.htm?context=WhatsNew&file=API.html [download.autodesk.com]
Just finished implementing the code and we're now able to import any amount of uv maps.
Andrew, if you'd like to take a look at the code / change, lmk.
Edited by - Sept. 16, 2015 13:10:08
Senior Technical Artist Guerrilla Games
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
Wow! I just did a quick test, and this actually seems to work! There is a equivalent for colorsets, and that also seems to work too!
These functions actually exist in 2012 as well, so they'll probably work in older versions too. Do you know if there are any downside to using them? I'm certain I asked Maya's support before if there's a way to do this. :?
This is really exciting. Thanks for the tip! I'll look into this as soon as I finish with my current task.
These functions actually exist in 2012 as well, so they'll probably work in older versions too. Do you know if there are any downside to using them? I'm certain I asked Maya's support before if there's a way to do this. :?
This is really exciting. Thanks for the tip! I'll look into this as soon as I finish with my current task.
Andrew / アンドリュー
- cklosters
- Member
- 224 posts
- Joined: Nov. 2008
- Offline
That's really great news Andrew. It's been in there since Maya85, but never documented or listed anywhere. Thanks to visual assist I found the definition and looked for examples online. There were a couple of examples that followed a similar structure to what is used inside the engine plugin, so thought I'd give it a go. I was already on my way to implement a rather cumbersome pipeline for supporting multiple uv sets and color.
I have no idea if there is any downside to using them, maybe get back to Autodesk and tell 'm to get their act together
Cheers Coen!
I have no idea if there is any downside to using them, maybe get back to Autodesk and tell 'm to get their act together
Cheers Coen!
Senior Technical Artist Guerrilla Games
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
Support for outputting multiple UVs is finally here! The change is in today's build (14.0.483).
If a mesh is inputted into Houdini Engine, the original Maya UV names are stored in a set of detail attributes (maya_uv_name and maya_uv_mapped_uv). When the mesh is outputted back into Maya, these detail attributes are used to name the output UVs. This should preserve the original names of the original UVs.
A minor note is that the output mesh will always have the “map1” UV set. If your output mesh uses it, then the UVs will be there. But if your output mesh doesn't use it, the UV set will just be empty. (This is a default UV set on a mesh, and I can't seem to find a way to delete it.)
There's a really small compatibility break here. It's easily fixable by just pressing sync. The attribute for outputting mesh data is changed from outputPartMesh to outputPartMeshData. This means if you open a scene that's saved in previous Engine versions, the mesh won't appear until you press sync. Hopefully this isn't too big of a problem.
One thing to watch for is that the “current UV set” name is only updated during sync. This is only an issue if your asset tries to change the default UV set procedurally.
Also, the plugin will now try to preserve UV borders. Previously, when a mesh is inputted into Engine, the UV sharing/sewing/stitch information would be lost. This results in all the UVs becoming UV borders. The plugin will now try to store this information in a vertex attribute (uvNumber). When the mesh is outputted back into Maya, the plugin will use this attribute to try to restore the UV sharing. If the mesh topology changed, the plugin will still make an attempt to sew the UVs together.
Big thanks to cklosters for pointing out the undocumented API that makes all this possible!
If a mesh is inputted into Houdini Engine, the original Maya UV names are stored in a set of detail attributes (maya_uv_name and maya_uv_mapped_uv). When the mesh is outputted back into Maya, these detail attributes are used to name the output UVs. This should preserve the original names of the original UVs.
A minor note is that the output mesh will always have the “map1” UV set. If your output mesh uses it, then the UVs will be there. But if your output mesh doesn't use it, the UV set will just be empty. (This is a default UV set on a mesh, and I can't seem to find a way to delete it.)
There's a really small compatibility break here. It's easily fixable by just pressing sync. The attribute for outputting mesh data is changed from outputPartMesh to outputPartMeshData. This means if you open a scene that's saved in previous Engine versions, the mesh won't appear until you press sync. Hopefully this isn't too big of a problem.
One thing to watch for is that the “current UV set” name is only updated during sync. This is only an issue if your asset tries to change the default UV set procedurally.
Also, the plugin will now try to preserve UV borders. Previously, when a mesh is inputted into Engine, the UV sharing/sewing/stitch information would be lost. This results in all the UVs becoming UV borders. The plugin will now try to store this information in a vertex attribute (uvNumber). When the mesh is outputted back into Maya, the plugin will use this attribute to try to restore the UV sharing. If the mesh topology changed, the plugin will still make an attempt to sew the UVs together.
Big thanks to cklosters for pointing out the undocumented API that makes all this possible!
Andrew / アンドリュー
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
Hey Andrew! I finally got a chance to try this in 15.0.270. you have no idea what a happy moment this was for me
One thing I did noticed though is that UV Sets which are currently created in Houdini and did not exist in maya (which do not have the uvNumber attribute) will come through split. Is this as expected, or do you expect that coincidentally positioned UVs created in Houdini should be sewn in maya? If not, should I try to create the uvNumber attribute myself?
this is great! very excited to have this available! Are you thinking you may attempt to also do the color sets as well? at that point I could represent any per point attribute in Maya as color sets
thank you again!
One thing I did noticed though is that UV Sets which are currently created in Houdini and did not exist in maya (which do not have the uvNumber attribute) will come through split. Is this as expected, or do you expect that coincidentally positioned UVs created in Houdini should be sewn in maya? If not, should I try to create the uvNumber attribute myself?
this is great! very excited to have this available! Are you thinking you may attempt to also do the color sets as well? at that point I could represent any per point attribute in Maya as color sets
thank you again!
-G
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
grayOlorinYeah, that's expected. The Maya plugin sew the UVs together according to the uvNumber. And the plugin also handles the case where the UVs were originally sewn together (i.e. same uvNumber), but the UV coords are not longer the same (i.e. the UV topology changed). You could abuse this to get the UVs sewn is to create a “uvNumber” attribute, and set all the values to the same number (e.g. 0). Then, the Maya plugin will try to fuse all the UV, because they share the same uvNumber. This is probably the easiest way, but it'll probably be slow because the plugin has to do a lot of searching.
One thing I did noticed though is that UV Sets which are currently created in Houdini and did not exist in maya (which do not have the uvNumber attribute) will come through split. Is this as expected, or do you expect that coincidentally positioned UVs created in Houdini should be sewn in maya? If not, should I try to create the uvNumber attribute myself?
If you could set the uvNumber on the Houdini side correctly, then that's even better. In the future, it'd be nice if Houdini itself is aware of this “uvNumber”.
grayOlorinYeah, I've been trying to get to it, but I got sidetracked to other things (again). Soon…
Are you thinking you may attempt to also do the color sets as well? at that point I could represent any per point attribute in Maya as color sets
Andrew / アンドリュー
-
- Quick Links