-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add faceset support to usd dev #758
Add faceset support to usd dev #758
Conversation
This work is a continuation of Adam Ferrall-Nunge's work in PixarAnimationStudios#219, which added support for Alembic facesets to USD. At that time they were represented as Faceset data on the parent prim, which was subsequently read by pxrUsdIn and expanded back to faceset nodes. Since then, USD introduced the GeomSubset prim type. To a large extent this simplified the problem: The exact same hierarchy is maintained between Alembic and USD with only the type changing (Alembic "Faceset" to USD "GeomSubset"). pxrUsdIn already has support for GeomSubset, so there was no need to make any pxrUsdIn changes for Katana.
Conflicts: pxr/usd/plugin/usdAbc/CMakeLists.txt
Filed as internal issue #USD-5049. |
Hi Alan, Cheers, |
Thanks, Spiff. |
*FamilyName* is supposed to be optional, so you should be able to leave it
empty.
That said, an “ideal” transcoding would have the alembicWriter authoring
the prim’s *familyName* as metadata or a property on the abc object, and
have the reader look for that, and if not present, then maybe use
“faceExclusivity” or “abcFamily” as familyName. In our current codebase,
the only place we’re creating Subsets is in the Maya exporter, for material
assignment, using the UsdShadeMaterialBinding API which sets the Subsets’
familyName to “materialBinding”, I think.
I can’t evaluate how important that level of roundtripping fidelity would
be, though.
On Wed, Jan 30, 2019 at 5:52 PM Alan Bucior ***@***.***> wrote:
Thanks, Spiff.
It seems I misunderstood how *familyType* and *familyName* are supposed
to work. Sorry about that.
After taking a look at this file
<https://github.com/PixarAnimationStudios/USD/blob/dev/pxr/usd/lib/usdGeom/testenv/testUsdGeomSubset/Sphere.usda>
as an example, it looks like I should have something like the following on
the geom:
uniform token subsetFamily:faceExclusivity:familyType = "<something>"
and then in the GeomSubset I should have:
uniform token familyName = "faceExclusivity"
I'm using "faceExclusivity" here because I need some sort of *familyName*,
and it seems appropriate to match the Alembic naming in this case. Does
that seem about right to you? If so I'll get that fixed up and update the
PR.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#758 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF7qaLe2K05fczl8e2-YSW5omKAIPXQgks5vIkxXgaJpZM4aYxVs>
.
--
--spiffiPhone
|
I see. Thanks for the explanation! |
Sounds to me like there is a bug and a FamilyName of "" does not work
correctly.
In any case everybody agreeing on the default FamilyName is probably the
best solution. If there is precedent for "materialBind" and "" cannot be
made to work then everybody should agree on that.
…On Thu, Jan 31, 2019 at 9:29 AM Alan Bucior ***@***.***> wrote:
I see. Thanks for the explanation!
As you say, I could leave familyName empty, but if that's the case then it
seems I wouldn't be able to specify familyType, as that's attached to a
family. As a test, I tried calling CreateGeomSubset() leaving the
familyName empty and specifying the familyType, but the resulting USD file
had no reference to my familyType. Given that familyType is even a little
bit round-trippable (via faceExclusivity), I think it makes sense to
specify a familyName in order to retain the familyType.
It looks like the UsdShadeMaterialBindingAPI is using
UsdShadeTokens->materialBind as the familyName. Given that Alembic can only
ever have one subset family (since there's only faceExclusivity and nothing
else), and it's most likely that Alembic faceSets would be used for
material binding, it feels appropriate to use materialBind as the
familyName here. I expect it's the "least surprising" choice from a user
point of view. Does that sound good to you?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#758 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABLBEd5bM6p_Wcya8X4Qouu9RhrFio60ks5vIyf4gaJpZM4aYxVs>
.
|
Agreed on all counts: let's go with materialBind, and there may well be a bug with empty familyName, as we haven't really exercised it (though we should at least be testing it in the unit tests). The only remaining question, if we care, is what to do in alembicWriter if there are multiple families of subsets for the same Mesh. This is currently an academic question as we don't have a use-case for it, but one could imagine making one family of subsets for material binding, and another for illumination or trace-groups... It would be good to agree on what the translation should be, even if we decide it's OK for it to be lossy. |
Alembic has no concept of familyName, so "materialBind" was used as the default family name here. In order to modify both the GeomSubset (to add the indices, etc) and the parent prim (to add the familyType), some modifications were made to the _PrimReaderContext and _PrimWriterContext to allow access to parent primitives.
I've pushed up a new commit. Please take a look when you get a chance. I've implemented the "materialBind" default here, as discussed. |
Hi Allen,
Very nice test! Thanks, and looking forward to getting this in for 19.05, |
- Removed copy paste error - Static token'ized some of the inline tokens and added them to alembicUtil.h - Checked for faceset's parent existing in alembicWriter - Also made some updates to the unit test. Some cleanups to make it more correct, and I think I'd made some updates there and failed to actually re-run the test, so a few things weren't working in there. Should be good now.
Add faceset support to usd dev (Internal change: 1940809)
Description of Change(s)
This work is a continuation of Adam Ferrall-Nunge's work in #219, which added support for Alembic facesets to USD. At that time they were represented as Faceset data on the parent prim, which was subsequently read by pxrUsdIn and expanded back to faceset nodes. That PR was never accepted because UsdGeomSubset was introduced which became the more appropriate choice for representation of Alembic Facesets.
To a large extent this simplified the problem: The exact same hierarchy is maintained between Alembic and USD with only the type changing (Alembic "Faceset" to USD "GeomSubset"). pxrUsdIn already has support for GeomSubset, so there was no need to make any pxrUsdIn changes for Katana.
This is a rebasing of #754 onto dev.
Testing
I've added a new unit test that performs round-tripping of faceset data from USD to Alembic and back again, verifying that the data is preserved as best as possible. It's not lossless, due to schema differences between Alembic and USD, but it's as good as can be represented, in my opinion.