tinyusdz icon indicating copy to clipboard operation
tinyusdz copied to clipboard

ConvertToRenderScene does not fill nodes and RenderMesh

Open MootoolsSoftware opened this issue 1 year ago • 1 comments

File: Netsuke_-_Shoki_capturing_an_oni.zip

`` tinyusdz::tydra::RenderSceneConverter converter; tinyusdz::tydra::RenderScene renderScene; ret = converter.ConvertToRenderScene(stage, &renderScene); XASSERT(ret); XASSERT(renderScene.nodes.size() != 0); for (size_t i = 0; i < renderScene.meshes.size(); i++) { tinyusdz::tydra::RenderMesh& rmesh = renderScene.meshes[i];

    XASSERT(rmesh.element_name.size() != 0);
    XASSERT(rmesh.abs_name.size() != 0);
}

In the above code and with the provided sample the 3 asserts pops.

It is like the ConvertToRenderScene does not fill its nodes field.
And the fields that allows to name the mesh and know their path are also missing.

Note that the problem occurs with all the sample we tried.

MootoolsSoftware avatar Jan 10 '24 09:01 MootoolsSoftware

Yes, nodes and filling element_name and abs_name to RenderMesh is not yet supported. I'll work on it soon.

I also plan to add display_name to RenderMesh/Node to transfer displayName in USD Prim(https://github.com/PixarAnimationStudios/OpenUSD/pull/2055)

syoyo avatar Jan 10 '24 12:01 syoyo

In the recent rendermesh-refactor branch, now node names, paths, id to mesh should be filled correctly.

$ tydra_to_renderscene input.usd 

...

nodes {
    node {
        type "xform"
        id -1
        prim_name "grid2"
        abs_path "/grid2"
        display_name ""
        local_matrix "( (1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0) )"
        children {
        node {
...

syoyo avatar Apr 15 '24 22:04 syoyo

dev branch now fills node's xform and names correctly.

https://github.com/syoyo/tinyusdz/blob/dev/models/translated-cube-001.usda

$ ./tydra_to_renderscene models/translated-cube-001.usda
nodes {
    node {
        type "xform"
        id -1
        prim_name "Cube"
        abs_path "/Cube"
        display_name ""
        local_matrix "( (2.0, 0.0, 0.0, 0.0), (0.0, 3.0, 0.0, 0.0), (0.0, 0.0, 4.0, 0.0), (-1.1853550672531129, 0.0, 1.9550952911376954, 1.0) )"
        global_matrix "( (2.0, 0.0, 0.0, 0.0), (0.0, 3.0, 0.0, 0.0), (0.0, 0.0, 4.0, 0.0), (-1.1853550672531129, 0.0, 1.9550952911376954, 1.0) )"
        children {
        node {
            type "mesh"
            id 0
            prim_name "Cube"
            abs_path "/Cube/Cube"
            display_name ""
            local_matrix "( (1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (100.0, 200.0, 300.0, 1.0) )"
            global_matrix "( (2.0, 0.0, 0.0, 0.0), (0.0, 3.0, 0.0, 0.0), (0.0, 0.0, 4.0, 0.0), (198.8146449327469, 600.0, 1201.9550952911377, 1.0) )"
        }
        }
    }
}

(Netsuke_-_Shoki_capturing_an_oni.zip should also be handled correctly)

syoyo avatar May 11 '24 22:05 syoyo