PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.11k stars 1.21k forks source link

Setting up Model Cards textures can hang HdStorm/USDVIEW #3239

Open deboisj opened 2 months ago

deboisj commented 2 months ago

Description of Issue

Setting up Model Card textures on point instances can cause hdStorm / usdview to hang. See repro steps bellow.

Breaking while it hangs it is looping here : https://github.com/PixarAnimationStudios/OpenUSD/blob/dev/pxr/imaging/hdSt/mesh.cpp#L366

I think numInstanceLevels is initialized to 0.... so -1 and it being a size_t/unsigned...it starts looping at the max value... it would probably end eventually...but....going to be a while!

Steps to Reproduce

Using this USDA file with a simple point instancer with draw modes / cards :

#usda 1.0
(
    endTimeCode = 1
    startTimeCode = 0
)

def Xform "Comp" (
    apiSchemas = ["GeomModelAPI"]
    kind = "assembly"
)
{
    def PointInstancer "Instancer" (
        kind = "assembly"
    )
    {
        point3f[] positions = [(0, 0, 0), (4, 4, 4)]
        int[] protoIndices.timeSamples = {
            0: [1, 1],
        }
        rel prototypes = [
            </Comp/Instancer/Protos/Proto1>,
            </Comp/Instancer/Protos/Proto2>,
        ]

        def "Protos" (
            kind = "assembly"
        )
        {
            def Xform "Proto1" (
                apiSchemas = ["GeomModelAPI"]
                kind = "component"
            )
            {
                uniform token model:cardGeometry = "cross"
                uniform token model:drawMode = "cards"
                token visibility = "visible"

                def Cube "cube"
                {
                    color3f[] primvars:displayColor = [(1, 0, 0)]
                }
            }

            def Xform "Proto2" (
                apiSchemas = ["GeomModelAPI"]
                kind = "component"
            )
            {
                uniform token model:cardGeometry = "cross"
                uniform token model:drawMode = "cards"
                token visibility = "visible"

                def Cone "cone"
                {
                    color3f[] primvars:displayColor = [(0, 1, 0)]
                }
            }
        }
    }
}

From the interpreter in USDVIEW, run this :

p = usdviewApi.stage.GetPrimAtPath("/Comp/Instancer/Protos/Proto2") m = UsdGeom.ModelAPI.Apply(p) m.CreateModelCardTextureXPosAttr().Set("D:\\Models\\USD\\uvgrid.jpg") m.CreateModelCardTextureYPosAttr().Set("D:\\Models\\USD\\uvgrid.jpg")

image

System Information (OS, Hardware)

Windows

Package Versions

0.24.05

jesschimein commented 2 months ago

Filed as internal issue #USD-9998