Maniphest T93906

Alembic not importing UVs (if file incorrectly sets geoScope to kVertexScope - even though actual data implies kFacevaryingScope - which 2.93 handled gracefully)
Closed, Archived

Assigned To
None
Authored By
zhangliqi (shadow_creeper)
Dec 9 2021, 4:25 PM
Tags
  • Import/Export
  • BF Blender
  • Pipeline, Assets & I/O
  • Alembic
Subscribers
Philipp Kant (philipp)
Philipp Oeser (lichtwerk)
Sybren A. Stüvel (sybren)
zhangliqi (shadow_creeper)

Description

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.19

Blender Version
Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: rBf1cca3055776
Worked: 2.93

Since rB3385c04598f2: Alembic: support reading per-vertex UV sets we are more strict in regards to "malformed" .abc (see discussion below)

Short description of error
in 2.93 import no question
but 3.0 uv data lost
abc file{F12721151}

Related Objects

Mentioned In
rB3385c04598f2: Alembic: support reading per-vertex UV sets
Mentioned Here
P2656 T93906_hack
rB3385c04598f2: Alembic: support reading per-vertex UV sets
rBf9567f6c63e7: Alembic: read/write generated coordinates of meshes
rB7c681477094e: Fix T88605: Alembic import crashes when missing `arbGeomParams`

Event Timeline

zhangliqi (shadow_creeper) created this task.Dec 9 2021, 4:25 PM
zhangliqi (shadow_creeper) renamed this task from abc import mmd 同 to import mmd turn to abc ,uv data lost.Dec 9 2021, 4:43 PM
zhangliqi (shadow_creeper) updated the task description.
Richard Antalik (ISS) changed the task status from Needs Triage to Confirmed.Dec 9 2021, 10:25 PM
Richard Antalik (ISS) edited projects, added Add-ons (BF-Blender), Import/Export; removed BF Blender.
Philipp Oeser (lichtwerk) claimed this task.Dec 10 2021, 9:25 AM
Philipp Oeser (lichtwerk) edited projects, added BF Blender, Pipeline, Assets & I/O, Alembic; removed Add-ons (BF-Blender).
Philipp Oeser (lichtwerk) added a subscriber: Philipp Oeser (lichtwerk).

Will check.

Philipp Oeser (lichtwerk) added a comment.Dec 10 2021, 11:08 AM

So, first findings:

  • importing this .abc was fine in 2.93, then
    • started crashing with rBf9567f6c63e7: Alembic: read/write generated coordinates of meshes
    • crash was fixed by rB7c681477094e: Fix T88605: Alembic import crashes when missing `arbGeomParams` (but no more UVs)

If I compare a simple .abc export of a cube with UVs [current master] and provided .abc I see the following:

/Cube/Cube/.geom:
ScalarProperty      float64_t[6]   .selfBnds[1] {interpretation=box}
ArrayProperty       float32_t[3]   P[1] {
                                    geoScope=vtx
                                    interpretation=point
                                   }
ArrayProperty       int32_t        .faceIndices[1]
ArrayProperty       int32_t        .faceCounts[1]
CompoundProperty                   .userProperties
CompoundProperty                   .arbGeomParams
CompoundProperty                   uv {
                                    arrayExtent=1
                                    geoScope=fvr
                                    interpretation=vector
                                    isGeomParam=true
                                    podExtent=2
                                    podName=float32_t
                                    sourceName=UVMap
                                   }
ArrayProperty       float32_t[3]   N[1] {
                                    arrayExtent=1
                                    geoScope=fvr
                                    interpretation=normal
                                    isGeomParam=true
                                    podExtent=3
                                    podName=float32_t
                                   }
/Cube/Cube/.userProperties:
ScalarProperty      bool_t         meshtype[1]
/Cube/Cube/uv:
ArrayProperty       float32_t[2]   .vals[1] {
                                    arrayExtent=1
                                    geoScope=fvr
                                    interpretation=vector
                                    isGeomParam=true
                                    podExtent=2
                                    podName=float32_t
                                    sourceName=UVMap
                                   }
/xform_0_material_0/mesh_0_material_0/.geom:
ScalarProperty      float64_t[6]   .selfBnds[101] {interpretation=box}
ArrayProperty       float32_t[3]   P[101] {
                                    geoScope=vtx
                                    interpretation=point
                                   }
ArrayProperty       int32_t        .faceIndices[101]
ArrayProperty       int32_t        .faceCounts[101]
ArrayProperty       float32_t[2]   uv[101] {
                                    arrayExtent=1
                                    geoScope=vtx
                                    interpretation=vector
                                    isGeomParam=true
                                    podExtent=2
                                    podName=float32_t
                                   }
ArrayProperty       float32_t[3]   N[101] {
                                    arrayExtent=1
                                    geoScope=vtx
                                    interpretation=normal
                                    isGeomParam=true
                                    podExtent=3
                                    podName=float32_t
                                   }

Seems like UVs are stored in plain ArrayProperty (instead of CompoundProperty / userProperties), also the sourceName is missing.
Checking why this was still importing fine before rBf9567f6c63e7 now.

@zhangliqi (shadow_creeper) : was this .abc exported from blender? (which version?)

zhangliqi (shadow_creeper) added a comment.EditedDec 10 2021, 11:17 AM

i use mikumikudance softwave of mikumiku bridge addon , .mmd exported to .abc
2.93 or c4d can import this abc
but 3.0 import will lost uv data
@Philipp Kant (philipp) Oeser (lichtwerk)

zhangliqi (shadow_creeper) added a subscriber: Philipp Kant (philipp).Dec 10 2021, 11:18 AM
zhangliqi (shadow_creeper) added a comment.EditedDec 10 2021, 11:24 AM

@Philipp Kant (philipp) Oeser
is it pssoble to do a test and use 2.93 code ti import if uv data is lost?

Philipp Oeser (lichtwerk) added a comment.Dec 10 2021, 11:31 AM

@zhangliqi (shadow_creeper) : I am on it, please use "lichtwerk" as my user name (poor Philipp Kant has been subscribed on accident to too many reports, sorry for this)

As it looks now, the real culprit commit is rB3385c04598f2: Alembic: support reading per-vertex UV sets, but checking further...

Philipp Oeser (lichtwerk) changed the task status from Confirmed to Needs Information from User.Dec 10 2021, 12:27 PM
Philipp Oeser (lichtwerk) added a subscriber: Sybren A. Stüvel (sybren).

So the real "problem" is actually in the file I think.
It defines the geoScope of the ArrayProperty as being kVertexScope:

geoScope=vtx

The indices look like they are meant for face corners though (they dont match the vertex count, but they match the loop count).
Prior to rB3385c04598f2: Alembic: support reading per-vertex UV sets, the scope wasnt checked as thoroughly, so face corners were always assumed [ and thus nobody noticed ;) -- everything was just read in as facecorner/loop data and all was good].
However, this is still an error in the file, if it exports the UVs on face corners, the scope should be kFacevaryingScope [ reg. C4D -- i can only assume they are sloopy as we were before rB3385c04598f2 :) ]:

geoScope=fvr

I can get it to import just fine doing the following hack [@Sybren A. Stüvel (sybren): this will never get allowed in master, right?]

1
2
3diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc
4index 830ec731e20..5d381a9aee3 100644
5--- a/source/blender/io/alembic/intern/abc_customdata.cc
6+++ b/source/blender/io/alembic/intern/abc_customdata.cc
7@@ -611,6 +611,11 @@ AbcUvScope get_uv_scope(const Alembic::AbcGeom::GeometryScope scope,
8 return ABC_UV_SCOPE_LOOP;
9 }
10
11+ /* Some software seems to be sloppy [writes loop UVs but specifies vertex scope...]. */
12+ if (scope == kVertexScope && indices->size() == config.totloop) {
13+ return ABC_UV_SCOPE_LOOP;
14+ }
15+
16 /* kVaryingScope is sometimes used for vertex scopes as the values vary across the vertices. To
17 * be sure, one has to check the size of the data against the number of vertices, as it could
18 * also be a varying attribute across the faces (i.e. one value per face). */

Anyways, to understand the mikumiku workflow better:

  • what is actually doing the .abc export? blender? which blender version?
    • if so, please provide an example .blend file (where the MDD is already imported), the MDD -- just prior to exporting the abc
    • also provide the abc export settings then
  • if not: which software produces the .abc?
Philipp Oeser (lichtwerk) updated the task description.Dec 10 2021, 12:44 PM
zhangliqi (shadow_creeper) mentioned this in rB3385c04598f2: Alembic: support reading per-vertex UV sets.Dec 10 2021, 12:53 PM
Philipp Oeser (lichtwerk) removed Philipp Oeser (lichtwerk) as the assignee of this task.Dec 17 2021, 10:47 AM

Still waiting for answers to this:

In T93906#1270093, @Philipp Oeser (lichtwerk) wrote:

Anyways, to understand the mikumiku workflow better:

  • what is actually doing the .abc export? blender? which blender version?
    • if so, please provide an example .blend file (where the MDD is already imported), the MDD -- just prior to exporting the abc
    • also provide the abc export settings then
  • if not: which software produces the .abc?

For until then, will step down as the one assigned here...

Philipp Oeser (lichtwerk) renamed this task from import mmd turn to abc ,uv data lost to Alembic not importing UVs (if file incorrectly sets geoScope to kVertexScope - even though actual data implies kFacevaryingScope - which 2.93 handled gracefully).Dec 17 2021, 10:49 AM
Philipp Oeser (lichtwerk) closed this task as Archived.Jan 10 2022, 10:20 AM

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.

Thanks again for the report. If the problem persists please open a new report with the required information.