tinyusdz icon indicating copy to clipboard operation
tinyusdz copied to clipboard

VertexVariability::FaceVarying not supported

Open MootoolsSoftware opened this issue 1 year ago • 5 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

MootoolsSoftware avatar Dec 20 '23 09:12 MootoolsSoftware

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 https://github.com/syoyo/tinyusdz/issues/50 and GeomSubset https://github.com/syoyo/tinyusdz/issues/103 to support (per-face) materials and texturing.

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

syoyo avatar Dec 20 '23 10:12 syoyo

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

MootoolsSoftware avatar Dec 20 '23 10:12 MootoolsSoftware

@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.

syoyo avatar Dec 20 '23 11:12 syoyo

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

https://github.com/syoyo/tinyusdz/commit/550f22db47f1f1a47eae0703d7631b572d20b926 https://github.com/syoyo/tinyusdz/commit/61757c2db1fc1c0189d7a327a9b81be2dadbd282

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 https://github.com/syoyo/tinyusdz/issues/50 and GeomSubset https://github.com/syoyo/tinyusdz/issues/103 to support (per-face) materials and texturing.

Stay tuned...

syoyo avatar Jan 04 '24 11:01 syoyo

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

MootoolsSoftware avatar Jan 10 '24 09:01 MootoolsSoftware

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.

syoyo avatar May 10 '24 19:05 syoyo