PixarAnimationStudios / OpenUSD

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

Missing primvars with nested instancing: PointInstancer with prototypes that are instanceable = true #3388

Open kseitz opened 1 week ago

kseitz commented 1 week ago

Description of Issue

Example USD code (discussion below):

#usda 1.0
(
)

class Xform "PrototypeCube"
{
    def Cube "PrototypeCubeShape"
    {
    }
}

def Xform "Instances"
{
    def "Cube1" (
        instanceable = true
        prepend references = </PrototypeCube>
    )
    {
        color3f[] primvars:displayColor = [(1,0,0)]
        double3 xformOp:translate = (-1.5, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]
    }

    def "Cube2" (
        instanceable = true
        prepend references = </PrototypeCube>
    )
    {
        color3f[] primvars:displayColor = [(0,0,1)]
        double3 xformOp:translate = (1.5, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]
    }
}

def PointInstancer "PointInstancer"
{
    point3f[] positions = [(0, -2.5, 0)]
    int[] protoIndices = [0]
    prepend rel prototypes = [</Instances>]
}

Cube1 and Cube2 are Scenegraph Instances of PrototypeCube. Cube1 and Cube2 each have a different primvars:displayColor (red and blue, respectively).

PointInstancer uses these Scenegraph Instances as a prototype.

Actual Results:

instanceable-true

Top Row: The Scenegraph Instances render as expected. Each cube shows its per-instance displayColor.

Bottom Row: The PointInstancer does NOT render as expected. The displayColors are missing.

Expected Results:

Change Cube1 and Cube2 to instanceable = false. Now, both the Scenegraph Instances and the PointInstancer render as expected. Both rows show the expected displayColors.

instanceable-false

Steps to Reproduce

Open the above USD code in usdview and view the image rendered by Hydra GL.

The top row shows the Scenegraph Instances. The displayColors are shown correctly.

The bottom row shows the PointInstancer. The displayColors are missing.

System Information (OS, Hardware)

This test was performed on Linux using an internal build of USD 23.08 with some modifications. I believe @marktucker tested this issue with USD 24.08 and found the same results.

Other Info

  1. Cube1 and Cube2 also specify per-instance transforms (on the same prims as the displayColor primvars). These per-instance transforms work as expected. Thus, the issue appears specific to per-instance primvars.

  2. I have tested this behavior both with other primvars and with other renderers, and the results are the same. The primvars are missing from the PointInstancer instances of the cubes.

  3. I believe this is a bug when translating the USD scene to the Hydra representation. When viewing the scene through Hydra Scene Browser, the PointInstancer has a duplicated mesh for each cube. Each mesh correctly shows the per-instance transform of the Scenegraph Instance. However, the primvars:displayColor is missing. See image below.

instanceable-true-hydra

jesschimein commented 1 week ago

Filed as internal issue #USD-10384