Maya material assignment

1,664 views
Skip to first unread message

leeG

unread,
Dec 10, 2013, 11:40:20 AM12/10/13
to alembic-d...@googlegroups.com
Is there a way in maya to save the material assignments per face so that when I export to an alembic file (non-gpu) and then import the alembic file I can reassign the materials so that the alembic object is not grey?

Does the alembic file/object have the information needed to do the reassignment?

I am sure I can write the script but I just don't know if it is supported by the maya alembic plugin.

leeG

Francois Chardavoine

unread,
Dec 10, 2013, 12:05:45 PM12/10/13
to alembic-d...@googlegroups.com
Yes, as of Alembic 1.1.2, if you export an Alembic file with the -wfs / -writeFaceSets flag, then it will store the material facesets in the file, and automatically recreate them when you load the file back in with AbcImport. It won't do any material assignments for you, but the sets will exist for you to re-assign them.

Francois.



--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

leeG

unread,
Dec 11, 2013, 12:23:31 AM12/11/13
to alembic-d...@googlegroups.com
Francois,
Thanks for your reply, that help.

lee

Sascha Herfort

unread,
Mar 26, 2014, 10:22:23 AM3/26/14
to alembic-d...@googlegroups.com
In our Maya 2013, we used to generate faceset attributes by script, to export per-face material assignment.
Now with Maya 2014 that's no longer necessary (or possible), but I ran into some nodes without facesets in the ABC file.

Turns out that the getSetComponents() method, doesn't return anything, if the entire mesh's shape is assigned to the shadingGroup. So objects that have only one material applied, don't get any facesets in the alembic file and and thus lose their material assignment.

Did anybody run into this problem as well and has a solution or workaround?
The way it is right now, I'm forced to stick to maya 2013 and our old slow faceset-script to export alembic caches.

Tom Price

unread,
Mar 26, 2014, 10:28:10 AM3/26/14
to alembic-d...@googlegroups.com
We avoid per face assignment entirely, finding it played badly with render Layers and frequently breaking. We query using the hypershade Command (which returns multiple SG if perface is used). Assinging via the assignSG command.

Also we have to retrieve the shader from the transform rather than shape as instances can have different shaders to their inheritted shapes.

We re still on 2013 with 1.5 Alembic, At present the shaders are stored in a seperate .ma with a json of the assignments (though in retrospect it would probably be better to store this on a custom atttribute that is itself baked)

Hope that helps,

TomP



--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


BAFTA Independent Production Company of the Year - 2012 Children's BAFTAs
twitter.com/blue_zoo | facebook.com/bluezooanimation | vimeo.com/bluezoo

blue-zoo, Chesterfield House, 385 Euston Road, London NW1 3AU
t. 020 7434 4111

Hans Baldzuhn

unread,
Mar 26, 2014, 10:58:44 AM3/26/14
to alembic-d...@googlegroups.com
Shouldn't AbcExport make use of AbcMaterial ?

This should save shader assignment then restore it on import.

Sascha Herfort

unread,
Mar 26, 2014, 1:43:56 PM3/26/14
to alembic-d...@googlegroups.com
Was that added at some point?

We built our pipeline on facesets, since our that was the only available solution for per-face-material-assignment.

I experimented a bit more and found another curiousity:

Scene A has two objects:
Both objects have a material applied to their full shape, like so: myShape.instObjGroups[0] -> myShadingEngine.dagSetMembers[0]
In this case neither object will have a faceset in the exported ABC.

Scene B has two objects:
Object_1 has a material applied to its full shape, like so: myShape.instObjGroups[0] -> myShadingEngine.dagSetMembers[0]
Object_2 has a material applied to some of its faces, like so: myShape.instObjGroups[0].objectGroups[0] -> myShadingEngine.dagSetMembers[0]
In this case Object_2 will have facesets as expect.
Object_1 will also have a faceset, but it contains the indices of Object_2's faceset for that material, rather than all faces.

Does that make sense?

I'll test around some more, but it sounds like this one is asking for a bug-report if there isn't one already.

Tom Price

unread,
Mar 26, 2014, 1:59:14 PM3/26/14
to alembic-d...@googlegroups.com
Interesting,

I ll test the Export with -WFS, I built this pipeline on V1 before AbcMaterial was added.
I ll also test the facesets too, and whether this works with instanced objects having different shaders from their inheritted shapes.

Do people here often use perFace shading? We heavilly discourage it as it tends to break easily.

TomP


--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lucas Miller

unread,
Mar 26, 2014, 2:07:15 PM3/26/14
to alembic-d...@googlegroups.com
AbcMaterial support wasn't ever added to AbcExport and AbcImport because materials aren't yet easily exchanged between tools.

It you want to export your Maya materials so you can bring them back into Maya later, then asking Autodesk nicely for support seems reasonable.

They can define whatever conventions they want as long as they set the target in AbcMaterial to Maya, or if they are really ambitious and want to define a material convention for all of their products they could set the target to Autodesk.

Other vendors (or even individual studios) are free to do the same thing (as long as they set the target) until the community can agree on how or if materials should be interchanged between apps.

Lucas


--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.

Sascha Herfort

unread,
Mar 27, 2014, 6:51:26 AM3/27/14
to alembic-d...@googlegroups.com
We use per-face-material-IDs in our game-engine, that we export the caches to.
3dsmax works like this natively, so it's easy to carry the information across.
However maya has no concept of material-IDs stored within a face, so we derive the material-ID from the material-name (i.e. mat03_wood).

A workaround seems to be enforcing an instObjGroups[].objectGroups[] assignment (as opposed to just instObjGroups[]) on all shapes.
However this calls for a very peculiar workflow, or some pre-export-scripts with potentially far-reaching knock-on-effects.

The bug seems to be in in the MayaMeshWriter module.
Do you think this is something that Autodesk should/could fix, or does it belong into the Alembic Group bugtracker?



On Wednesday, March 26, 2014 6:59:14 PM UTC+1, Tom Price wrote:
Interesting,

I ll test the Export with -WFS, I built this pipeline on V1 before AbcMaterial was added.
I ll also test the facesets too, and whether this works with instanced objects having different shaders from their inheritted shapes.

Do people here often use perFace shading? We heavilly discourage it as it tends to break easily.

TomP
On 26 March 2014 14:58, Hans Baldzuhn <hans.b...@gmail.com> wrote:
Shouldn't AbcExport make use of AbcMaterial ?

This should save shader assignment then restore it on import.


On Tuesday, December 10, 2013 5:40:20 PM UTC+1, leeG wrote:
Is there a way in maya to save the material assignments per face so that when I export to an alembic file (non-gpu) and then import the alembic file I can reassign the materials so that the alembic object is not grey?

Does the alembic file/object have the information needed to do the reassignment?

I am sure I can write the script but I just don't know if it is supported by the maya alembic plugin.

leeG

--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discussion+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lucas Miller

unread,
Mar 27, 2014, 12:27:52 PM3/27/14
to alembic-d...@googlegroups.com
If you can create and share a simple test case then the Alembic issues list is a good start:

If it's something you can't share then you should contact Autodesk.

Lucas


To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages