Confusion about USDLoadOptions
Closed this issue · 8 comments
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.
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!
Composition is work-in-progress, and at least you should use LoadLayer(construct Layer/PrimSpec).
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.
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.
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)
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.
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
Line 171 in a841a47
DCOUT
debug printf macro. It should help a lot!@AMZN-Gene Running tydra_to_renderscene example is also worth to try: https://github.com/lighttransport/tinyusdz/tree/dev/examples/tydra_to_renderscene
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+.
@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
)
{
You can sponsor TinyUSDZ project to increase the priority of the supporting (nested) Variants #94 , or contribute implementing (nested) Variants in TinyUSDZ.
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.