Getting Pref from Maya to Gaffer via Alembic

477 views
Skip to first unread message

Carlo Giesa

unread,
Mar 24, 2022, 7:48:34 AM3/24/22
to gaffer-dev
Hi there!

Sorry if that might be obvious, but I'm trying to get 'Pref' data out of Maya to Gaffer via the alembic format. Inside Maya, I create a custom attribute of type 'vectorArray' that contains the Pref data. I include this attribute into the abc which is stored in the '.arbGeomParams' compound property.

When I load the alembic in Gaffer, I can find it in the primitive inspector as constant variable. When rendering it, I get following error:

WARNING [setParameter] Unsupported data type "V3dVectorData" for name "Pref"

And when I try to resample the primitive attribute to a 'Vector' type, nothing happens.

I did try to copy the P value to my Pref which works as expected, but this would apply a more complex setup inside Gaffer loading the model in bind pose together with the animated bakes.

Is there something obvious that I'm missing?

Greets,
Carlo

John Haddon

unread,
Mar 24, 2022, 11:58:05 AM3/24/22
to gaffe...@googlegroups.com
I think Gaffer/Arnold is expecting a V3f (vector of floats) rather than a V3d (vector of doubles). I'm not sure what that equates to as a Maya attribute type, but maybe it gives you something to go on?

--
You received this message because you are subscribed to the Google Groups "gaffer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gaffer-dev/c596f6a3-a904-4140-90cb-96c62f047780n%40googlegroups.com.

Carlo Giesa

unread,
Mar 24, 2022, 12:39:13 PM3/24/22
to gaffe...@googlegroups.com
Hi John!

Thanks for your reply. I fear that Maya does not give a lot of options for vector array attributes. I did not find anything in MEL/Python, nor in the C++ library.

Greets,
Carlo


John Haddon

unread,
Mar 25, 2022, 5:58:14 AM3/25/22
to gaffe...@googlegroups.com
That's a pity - I can't think of a good way of doing the conversion in Gaffer given the available nodes.

Generally, doubles aren't supported well in Gaffer because we're focused on rendering, and the renderers tend to want floats. We haven't really taken a stance either way, but it seems like we either need to a) improve support for doubles in Gaffer and perform a conversion to float in the renderer where necessary or b) standardise on floats internally and convert double-to-float on loading. Any opinions on that? I suppose the least opinionated solution to the immediate problem would be to support the double-to-float conversion to Arnold - it wouldn't really commit us either way, and it wouldn't change any existing workflows.

One thing is confusing me though. From the warning message, and looking at the code, I would guess that `Pref` you has has been flagged as `Constant`, rather than `Vertex`. Can you confirm? If so, that would need fixing in the Alembic export before a double-to-float conversion would be useful...

Cheers...
John


Carlo Giesa

unread,
Mar 25, 2022, 9:31:36 AM3/25/22
to gaffe...@googlegroups.com
Hi John!

One thing is confusing me though. From the warning message, and looking at the code, I would guess that `Pref` you has has been flagged as `Constant`, rather than `Vertex`. Can you confirm? If so, that would need fixing in the Alembic export before a double-to-float conversion would be useful...

Yes, exactly. That confuses me as well. And resampling from a constant to a vector does not seem to work.

Another option (maybe) might be to enhance the resample primitive variables node by including type conversion. This would make it more explicit, no?

Greets,
Carlo

Carlo Giesa

unread,
Mar 25, 2022, 9:32:03 AM3/25/22
to gaffe...@googlegroups.com
Resampling from constant to vertex..... I meant. :-)

John Haddon

unread,
Mar 25, 2022, 11:09:30 AM3/25/22
to gaffe...@googlegroups.com
The definition of a constant primitive variable is that it has the same value over the whole primitive, so the right way to resample it vertex-wise is to copy that same value to each vertex. That's not working here because the value is an array, and we don't support array-per-vertex primvars.

Whether or not we should support Pref as doubles is a legitimate matter for debate, but if the Maya exporter is making constant Pref rather than vertex then that's just plain wrong. You could write a node to reinterpret it, but really I think that'd be fixing the problem in the wrong place.

I couldn't find anything in the Maya docs, but the original Alembic source implies that you can set the scope and type of an arbitrary attribute by making additional `<attributeName>_AbcGeomScope` and `<attributeName>_AbcType` attributes. Might be worth a shot?


Cheers...
John

Carlo Giesa

unread,
Mar 27, 2022, 11:49:50 AM3/27/22
to gaffe...@googlegroups.com
Ah great! Thanks for the hint. I will take a look into that.

Reply all
Reply to author
Forward
0 new messages