lighttransport/tinyusdz

VertexVariability::FaceVarying not supported

MootoolsSoftware opened this issue · 6 comments

Hello,
We are trying a support of the lib for our 3DBrowser to be able to generate thumbnails for USD file.
Tinyusdz seems to be a nice alternative to the openUSD huge solution.

We are using tydra but are currently stuck to the following problem in render-data.cc

       if (vattr.variability != VertexVariability::FaceVarying) {
          PUSH_ERROR_AND_RETURN(
              fmt::format("TODO: non-facevarying UV texcoord attribute is not "
                          "support yet: {}.\n",
                          uvname));
        }

Most of the face are using VertexVariability::FaceVarying (at least the one generated by sketchfab) and that would be better to warn about such data instead of returning an error.
Doing that most of the files simply can be treated.

Model to reproduce problem: Furriers_guild_chest_in_Myslenice.zip
Credits: https://sketchfab.com/WirtualneMuzeaMalopolski

Strangely, it seems that supporting VertexVariability::FaceVarying is supported for normals but not for UVs,
Is there any reason for that?

Do you plan to support VertexVariability::FaceVarying

Anyway thanks for such a good job,
Manuel

syoyo commented

Strangely, it seems that supporting VertexVariability::FaceVarying is supported for normals but not for UVs,
Is there any reason for that?

USD to RenderMesh(OpenGL/Vulkan) conversion in Tydra is still work-in-progress, and simply I haven't yet working on it.
(You can contribute! or sponsor TinyUSDZ development to prioritize USD to RenderMesh conversion)

I'm now working on material binding #50 and GeomSubset #103 to support (per-face) materials and texturing.

Then will work on converting geometric attributes(UVs, normals, ...).

Thanks Syoyo for the answer. Sponsoring done. We do appreciate your Tiny libs.

syoyo commented

@MootoolsSoftware Thank you for the prompt sponsoring! 🙏 Increase the priority of USD to RenderMesh conversion. I think some working code will be available in this year-end.

Implemented converting Constant/Uniform and Varying/Vertex texcoord to facevarying Texcoords in recent dev branch

550f22d
61757c2

Now tydra_to_renderscene can process Furriers_guild_chest_in_Myslenice.zip, and tydra::DumpRenderScene shows facevaryingTexcoords values.

$ ./tydra_to_renderscene Furriers_guild_chest_in_Myslenice.usdz
...
        num_texcoordSlots 1
        num_facevaryingTexcoords_0 61776
            facevaryingTexcoords_0 "[(0.8131, 0.8341), (0.8078, 0.83570006), (0.8082, 0.82809999), (0.8082, 0.82809999), (0.8024, 0.8327), (0.8012, 0.8254), (0.8078, 0.83570006), (0.8024, 0.8327), (0.8082, 0.82809999), (0.8024, 0.8327), (0.7972, 0.83640006), (0.7951, 0.8279), (0.7907, 0.8339), (0.7858, 0.83959999), (0.7841, 0.8327), (0.7858, 0.83959999), ..., (0.7367, 0.042100014), (0.7446, 0.042100014), (0.7473, 0.043299974), (0.7426, 0.04250002), (0.7394, 0.050300003), (0.7378, 0.059000017), (0.7353, 0.052999975), (0.7426, 0.04250002), (0.7473, 0.043299974), (0.7455, 0.046199979), (0.7467, 0.05309999), (0.7378, 0.059000017), (0.7394, 0.050300003), (0.7417, 0.040799977), (0.7426, 0.04250002), (0.7391, 0.04000002)]"

For correctly do texture mapping(including assigning Material), this is not enough. We still need to implement converting MaterialBinding and GeomSubset to Tydra RenderScene(OpenGL/Vulkan friendly scene data structure)

I'm now working on material binding #50 and GeomSubset #103 to support (per-face) materials and texturing.

Stay tuned...

Thanks syoyo.
The mesh is now correctly processed :-)

We still need to implement converting MaterialBinding and GeomSubset to Tydra RenderScene(OpenGL/Vulkan friendly scene data structure)

FaceVarying conversion and MaterialBinding/GeomSubset is now supported in dev branch.