Skip to content

Point instancers can't be hidden in USD 25.05 & Hydra 2 #3693

@robp-sidefx

Description

@robp-sidefx

In #3011 we had an issue where geometry instanced by a PointInstancer wouldn't be visible. The fix for this (1cea084#diff-d1aaf0c1369d2e06760f26bb7e80b5783b21a10a3a5f7edcf725488aab714b4fR76-R78) was, I think, a bit too heavy-handed, whereby visibility is now always forced to true.

The problem is that if the PointInstancer is itself invisible (directly or through inheritance), the items it's instancing are now always visible.

This is proving a problem in workflows where we want to create native instances of point instancers, hiding the original one.

I think/suspect/hope the solution is to rather than hardcode true for the visibility of the point instances, use the visibility of the point instancer.

Simple example:

#usda 1.0
(
    endTimeCode = 1
    framesPerSecond = 24
    metersPerUnit = 1
    startTimeCode = 1
    timeCodesPerSecond = 24
    upAxis = "Y"
)

def PointInstancer "pointinstancer1" (
    kind = "group"
)
{
    float3[] extent.timeSamples = {
        1: [(-1, -1, -1), (1, 1, 1)],
    }
    int64[] invisibleIds = []
    quath[] orientations = [(1, 0, 0, 0)]
    point3f[] positions = [(0, 0, 0)]
    int[] protoIndices = [0]
    rel prototypes = </pointinstancer1/Prototypes/sphere1>
    token visibility = "invisible"

    def Scope "Prototypes" (
        kind = "group"
    )
    {
        def Sphere "sphere1"
        {
            float3[] extent = [(-1, -1, -1), (1, 1, 1)]
            double radius = 1
            matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
            uniform token[] xformOpOrder = ["xformOp:transform"]
        }
    }
}

Image

NI of PI example:

#usda 1.0
(
    endTimeCode = 1
    framesPerSecond = 24
    metersPerUnit = 1
    startTimeCode = 1
    timeCodesPerSecond = 24
    upAxis = "Y"
)

def Xform "instancer1" (
    kind = "group"
)
{
    def Scope "Prototypes" (
        kind = "group"
    )
    {
        token visibility = "invisible"

        def PointInstancer "pointinstancer1" (
            kind = "group"
        )
        {
            float3[] extent.timeSamples = {
                1: [(-1, -1, -1), (1, 1, 1)],
            }
            int64[] invisibleIds = []
            quath[] orientations = [(1, 0, 0, 0)]
            point3f[] positions = [(0, 0, 0)]
            int[] protoIndices = [0]
            rel prototypes = </instancer1/Prototypes/pointinstancer1/Prototypes/sphere1>

            def Scope "Prototypes" (
                kind = "group"
            )
            {
                def Sphere "sphere1"
                {
                    float3[] extent = [(-1, -1, -1), (1, 1, 1)]
                    double radius = 1
                    matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
                    uniform token[] xformOpOrder = ["xformOp:transform"]
                }
            }
        }
    }

    def "Instance0" (
        instanceable = true
        prepend references = </instancer1/Prototypes/pointinstancer1>
    )
    {
        matrix4d xformOp:transform:instancer1 = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (2, 0, 0, 1) )
        uniform token[] xformOpOrder = ["xformOp:transform:instancer1"]
    }
}

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions