Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion about USDLoadOptions #173

Closed
MootoolsSoftware opened this issue Jun 20, 2024 · 8 comments
Closed

Confusion about USDLoadOptions #173

MootoolsSoftware opened this issue Jun 20, 2024 · 8 comments
Labels
wontfix This will not be worked on

Comments

@MootoolsSoftware
Copy link

TinyUSD dev branch, updated on June, 17 2024

USDLoadOptions provides different options for handling sublayers, references...

We are working on kitchen set but do not succeed to get access to the geometry.
kitchen set seems to be handled correctly but we probably do not operate in the right way.

image

Here is the shot code we use:

tinyusdz::USDLoadOptions usdoptions;
usdoptions.do_composition = true;
usdoptions.load_references = true;
usdoptions.load_payloads = true;
usdoptions.load_sublayers = true;

tinyusdz::Stage stage;
tinyusdz::USDZAsset usdz_asset;
tinyusdz::AssetResolutionResolver arr;

bool ret = tinyusdz::LoadUSDFromFile(filename, &stage, &warn, &err, usdoptions);

MeshMap meshmap;
tinyusdz::tydra::ListPrims(stage, meshmap);

for (const auto& item : meshmap) // <- Mesh map is empty

So, how to get access to the kitchen set data?
What is the proper way to achieve this?
Should we use Stage?

Thanks!

@syoyo
Copy link
Collaborator

syoyo commented Jun 20, 2024

Composition is work-in-progress, and at least you should use LoadLayer(construct Layer/PrimSpec).

https://github.com/syoyo/tinyusdz/blob/7f3ae22884cfa8e1834f1750c30c807f0df466c6/examples/tusdcat/main.cc#L120

You can contribute to test with Kitchen set, investigate composition issues, and submit the fix(if the fix needed)

And I'm planning to deprecate composition flags in USDLoadOptions. These are added before implementing LoadLayer API.

@syoyo syoyo added the wontfix This will not be worked on label Jun 20, 2024
@syoyo syoyo closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2024
@AMZN-Gene
Copy link

Running into the same issue with kitchen_set, and hoping to resolve it.
Strangely, even directly loading the geom assets (like assets/woodenspoon/woodenspoon.geom.usd) tydra::ListPrims(stage, meshmap) is failing to find any tinyusdz::GeomMesh's.
However, I can clearly see output printing the faces and vertices.
image

@syoyo
Copy link
Collaborator

syoyo commented Aug 9, 2024

Running into the same issue with kitchen_set, and hoping to resolve it.

You can contribute to test with Kitchen set, investigate composition issues, and submit the fix(if the fix needed)

@AMZN-Gene
Copy link

AMZN-Gene commented Aug 9, 2024

Running into the same issue with kitchen_set, and hoping to resolve it.

You can contribute to test with Kitchen set, investigate composition issues, and submit the fix(if the fix needed)

Aye. I think I found where in the stage tree the mesh is stored. Might just a matter of updating TraverseRec to ensure it visits every node properly. Stay tuned...

I wanted to mention even loading woodenspoon.geom.usd directly is failing to load. I believe "composition" doesn't play any part there, since i'm loading the geom file directly. I can turn off subLayers, inherits, variantSets, references, and payloads and still see the mesh data is loaded into memory. I'm new to USD, so was thinking this might shed light for experienced users to point me in a better direction.

@syoyo
Copy link
Collaborator

syoyo commented Aug 9, 2024

Might just a matter of updating TraverseRec to ensure it visits every node properly. Stay tuned...

👍 I think it should visit every GeomMesh Prim in the Stage hierarchy correctly, but may have some issues somewhere.

I'm new to USD, so was thinking this might shed light for experienced users to point me in a better direction.

You can enable TINYUSDZ_DEBUG_PRINT in cmake

option(
to print DCOUT debug printf macro. It should help a lot!

@syoyo
Copy link
Collaborator

syoyo commented Aug 9, 2024

@AMZN-Gene Running tydra_to_renderscene example is also worth to try: https://github.com/lighttransport/tinyusdz/tree/dev/examples/tydra_to_renderscene

#148

It reads USD and convert to OpenGL/Vulkan friendly data structure(e.g. triangulate all meshes), and has a feature to output the result as .obj and USD(again). These result can be opened in the Blender 4.1+.

@syoyo
Copy link
Collaborator

syoyo commented Aug 9, 2024

@AMZN-Gene Ah, assets/woodenspoon/woodenspoon.geom.usd contains Variants(variantSet), which is not supported in TinyUSDZ Tydra ListPrims API at the moment.

    variantSet "modelingVariant" = {
        "WoodenSpoonA" {
            def Xform "Geom"
            {
                def Mesh "WoodenSpoon" (
                    hidden = true
                )
                {

#169

You can sponsor TinyUSDZ project to increase the priority of the supporting (nested) Variants #94 , or contribute implementing (nested) Variants in TinyUSDZ.

@AMZN-Gene
Copy link

AMZN-Gene commented Aug 9, 2024

Beautiful! Noticing that now too... earlier I thought "composition" wouldn't be required, but indeed, composition feature includes "variants". tusdcat includes checking for variants, but ListPrims still doesn't find this:

stage._root_nodes[0]._variantSets["modelingVariant"].second.varientSet.second._primChildren[0]._children[0]._prim_type_name = "Mesh"

I'll continue the conversation at #94.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants