Reading poly meshes with missing indexed UVs

229 views
Skip to first unread message

Andrew Harvey

unread,
Jul 20, 2012, 11:35:37 AM7/20/12
to alembic-d...@googlegroups.com
Hi there,

I'm currently trying to read indexed UV data from an Alembic file that
was exported using the reference Maya plugin. There are no problems if
every face-vertex has an associated UV. I get into trouble though when
UVs are missing from the Maya geometry. That is, the number of UV
indices is less than the number of face indices.

If we look at MayaMeshWriter::getUVs() in the abcexport plugin:

http://code.google.com/p/alembic/source/browse/maya/AbcExport/MayaMeshWriter.cpp#94

we can see the following:

MIntArray uvCounts, uvIds;
status = lMesh.getAssignedUVs(uvCounts, uvIds, &uvSetName);

The information in uvCounts is not written out anywhere... The
assumption therefore seems to be that the UV counts should match the
polygon face counts (the number of vertices per face.) If we are
missing UVs though, this assumption no longer holds.

Is this an oversight in the abcexport plugin or am I missing
something? (probably the latter! :)

Many thanks,

- Andrew

Kevin Sallée

unread,
Jul 20, 2012, 11:46:23 AM7/20/12
to alembic-d...@googlegroups.com
We had the same issue: all the faces/vertices must have an associated UV if not it doesn't manage to read them when you import the .abc. For the moment we asked the texturing team to make UV's for all faces/vertices.

--
You received this message because you are subscribed to the Google
Groups "alembic-discussion" group.
To post to this group, send email to alembic-d...@googlegroups.com
To unsubscribe from this group, send email to
alembic-discuss...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/alembic-discussion?hl=en

For RSS or Atom feeds related to Alembic, see:

http://groups.google.com/group/alembic-dev/feeds

http://groups.google.com/group/alembic-discussion/feeds



--
Kevin SALLEE,
kevin....@gmail.com

Lucas Miller

unread,
Jul 20, 2012, 12:22:59 PM7/20/12
to alembic-d...@googlegroups.com
The documentation on this is a little confusing:

It does say:
This method finds all texture coordinates for the mesh that have been mapped, and returns them in the same format as the assignUVs.

But then it goes on to say:
The uvCounts array that is returned will contain the number of uv's per polygon. Since uv's are mapped per-polygon per-vertex, the entries in this array will match the vertex counts for each polygon in the mesh. For example, the array for a cube would be { 4, 4, 4, 4, 4, 4 } since there are 6 polygons each with 4 vertices.

So when there are unmapped texture coordinates, is this reflected in uvCounts or uvIds, or possibly both?

An example would be nice.

Lucas

Andrew Harvey

unread,
Jul 20, 2012, 1:08:43 PM7/20/12
to alembic-d...@googlegroups.com
Hi there,

For polygons without UVs, I would imagine their entry in the uvCounts
array will be 0. The sum of all the counts in the uvCounts array
should then equal the length of the uvIds array.

If this is indeed the case there is a quick solution: Write out a
padded uvIndices array to the Alembic cache, thereby ensuring all the
lengths match. For every 0 entry in uvCounts, a suitable number of
"dummy" indices are inserted (one for each of the polygon vertices.)
The dummy index points to a (0,0) UV value, and is written to the
cache alongside all the other UV values. The advantage of this
approach is that only the Maya exporter needs to be modified and
nothing else.

- Andrew

Lucas Miller

unread,
Jul 27, 2012, 1:56:11 PM7/27/12
to alembic-d...@googlegroups.com
While reviewing issues that have been addressed for an upcoming release, I may have fixed this in my own repo a while ago:

Kevin Sallée

unread,
Jul 27, 2012, 2:43:08 PM7/27/12
to alembic-d...@googlegroups.com
sweet! thank you! we'll have less hassles with UV's thanks to this, at least until I find a way to bypass UV's when connecting an abc to a mesh.
Kevin

Andrew Harvey

unread,
Jul 28, 2012, 9:27:07 AM7/28/12
to alembic-d...@googlegroups.com
Hi Lucas - that's great to hear. Thank you very much!

- Andrew
Reply all
Reply to author
Forward
0 new messages