Modifying variant set option in a child reference from the parent variant set

Please provide all relevant details below before submitting your post. This will help the community provide more accurate and timely assistance. After submitting, you can check the appropriate boxes. Remember, you can always edit your post later to include additional information if needed.

Isaac Sim Version

4.2.0
4.1.0
4.0.0
2023.1.1
2023.1.0-hotfix.1
Other (please specify):

Isaac Lab Version (if applicable)

1.2
1.1
1.0
Other (please specify):

Operating System

Ubuntu 22.04
Ubuntu 20.04
Windows 11
Windows 10
Other (please specify):

GPU Information

  • Model: RTX 3090
  • Driver Version: 535

Topic Description

Modifying variant set option in a child reference from the parent variant set.

Detailed Description

It is not possible to create a variant set that will set variant sets of child objects. Imagine a situation where you have a duck asset that has a variant set alive with variants dead and alive. If you put 3 ducks on the scene and then try to add a root variant set to control the childrens’ alive variantsets it will not work the value seems to be always dead, which is the first on the variant list.

Even though the value is displayed as off its actually on

cc @pcallender @jlafleche @hclever

My first thought would have been local opinion overriding the parent, but the editor should be showing that if it was the case.

I’ve attached a USD featuring variant of variants appears to work on my environment with Isaac 4.2. Could you try it and see if you experience the same issue on this file (variants.usda)?

variant_child.usda

#usda 1.0
(
    defaultPrim = "hello"
)

def Xform "hello" (
    variants = {
        string shadingVariant = "green"
    }
    prepend variantSets = "shadingVariant"
)
{
    custom double3 xformOp:translate = (4, 5, 6)
    uniform token[] xformOpOrder = ["xformOp:translate"]

    def Sphere "world"
    {
        float3[] extent = [(-2, -2, -2), (2, 2, 2)]
        color3f[] primvars:displayColor
        double radius = 2
    }

    variantSet "shadingVariant" = {
        "blue" {
            over "world"
            {
                color3f[] primvars:displayColor = [(0, 0, 1)]
            }
        }

        "green" {
            over "world"
            {
                color3f[] primvars:displayColor = [(0, 1, 0)]
            }
        }

        "red" {
            over "world"
            {
                color3f[] primvars:displayColor = [(1, 0, 0)]
            }
        }
    }
}

variants.usda

#usda 1.0
(
    defaultPrim = "World"
)

def Xform "World" (
    variants = {
        string colour = "red"
    }
    prepend variantSets = "colour"
)
{
    def "variant_child" (
        prepend references = @./variant_child.usda@
    )
    {
        custom double3 xformOp:translate = (-10, 5, 6)
    }

    def "variant_child_01" (
        prepend references = @./variant_child.usda@
    )
    {
        custom double3 xformOp:translate = (10, 5, 6)
    }

    def "variant_child_02" (
        prepend references = @./variant_child.usda@
    )
    {
    }
    variantSet "colour" = {
        "blue" {
            over "variant_child" (
                variants = {
                    string shadingVariant = "blue"
                }
            )
            {
            }

            over "variant_child_01" (
                variants = {
                    string shadingVariant = "blue"
                }
            )
            {
            }

            over "variant_child_02" (
                variants = {
                    string shadingVariant = "blue"
                }
            )
            {
            }

        }
        "green" {
            over "variant_child" (
                variants = {
                    string shadingVariant = "green"
                }
            )
            {
            }

            over "variant_child_01" (
                variants = {
                    string shadingVariant = "green"
                }
            )
            {
            }

            over "variant_child_02" (
                variants = {
                    string shadingVariant = "green"
                }
            )
            {
            }

        }
        "red" {
            over "variant_child" (
                variants = {
                    string shadingVariant = "red"
                }
            )
            {
            }

            over "variant_child_01" (
                variants = {
                    string shadingVariant = "red"
                }
            )
            {
            }

            over "variant_child_02" (
                variants = {
                    string shadingVariant = "red"
                }
            )
            {
            }

        }
    }
}

I did uncheck the local option. Will try your code now…

Your code seems to work. It looks like my scenario is more complex. I will try to reproduce it in a simple form.

Use this as the main file. No matter what you choose its always green.

#usda 1.0
(
    customLayerData = {
        dictionary cameraSettings = {
            dictionary Front = {
                double3 position = (5, 0, 0)
                double radius = 5
            }
            dictionary Perspective = {
                double3 position = (5, 5, 5)
                double3 target = (-3.978038431995401e-8, -3.978038254359717e-8, 7.95607677517296e-8)
            }
            dictionary Right = {
                double3 position = (0, -5, 0)
                double radius = 5
            }
            dictionary Top = {
                double3 position = (0, 0, 5)
                double radius = 5
            }
            string boundCamera = "/OmniverseKit_Persp"
        }
        dictionary omni_layer = {
            string authoring_layer = "./variants_complex.usda"
            dictionary locked = {
            }
            dictionary muteness = {
            }
        }
        dictionary renderSettings = {
            float3 "rtx:debugView:pixelDebug:textColor" = (0, 1e18, 0)
            float3 "rtx:fog:fogColor" = (0.75, 0.75, 0.75)
            float3 "rtx:index:backgroundColor" = (0, 0, 0)
            float3 "rtx:index:regionOfInterestMax" = (0, 0, 0)
            float3 "rtx:index:regionOfInterestMin" = (0, 0, 0)
            float3 "rtx:post:backgroundZeroAlpha:backgroundDefaultColor" = (0, 0, 0)
            float3 "rtx:post:colorcorr:contrast" = (1, 1, 1)
            float3 "rtx:post:colorcorr:gain" = (1, 1, 1)
            float3 "rtx:post:colorcorr:gamma" = (1, 1, 1)
            float3 "rtx:post:colorcorr:offset" = (0, 0, 0)
            float3 "rtx:post:colorcorr:saturation" = (1, 1, 1)
            float3 "rtx:post:colorgrad:blackpoint" = (0, 0, 0)
            float3 "rtx:post:colorgrad:contrast" = (1, 1, 1)
            float3 "rtx:post:colorgrad:gain" = (1, 1, 1)
            float3 "rtx:post:colorgrad:gamma" = (1, 1, 1)
            float3 "rtx:post:colorgrad:lift" = (0, 0, 0)
            float3 "rtx:post:colorgrad:multiply" = (1, 1, 1)
            float3 "rtx:post:colorgrad:offset" = (0, 0, 0)
            float3 "rtx:post:colorgrad:whitepoint" = (1, 1, 1)
            float3 "rtx:post:lensDistortion:lensFocalLengthArray" = (10, 30, 50)
            float3 "rtx:post:lensFlares:anisoFlareFalloffX" = (450, 475, 500)
            float3 "rtx:post:lensFlares:anisoFlareFalloffY" = (10, 10, 10)
            float3 "rtx:post:lensFlares:cutoffPoint" = (2, 2, 2)
            float3 "rtx:post:lensFlares:haloFlareFalloff" = (10, 10, 10)
            float3 "rtx:post:lensFlares:haloFlareRadius" = (75, 75, 75)
            float3 "rtx:post:lensFlares:isotropicFlareFalloff" = (50, 50, 50)
            float3 "rtx:post:lensFlares:spectralBlurWavelengthRange" = (380, 550, 770)
            float3 "rtx:post:tonemap:whitepoint" = (1, 1, 1)
            float3 "rtx:raytracing:indexdirect:svoBrickSize" = (32, 32, 32)
            float3 "rtx:raytracing:inscattering:singleScatteringAlbedo" = (0.9, 0.9, 0.9)
            float3 "rtx:raytracing:inscattering:transmittanceColor" = (0.5, 0.5, 0.5)
            float3 "rtx:sceneDb:ambientLightColor" = (0.1, 0.1, 0.1)
            double "rtx:translucency:worldEps" = 0.005
            float2 "rtx:viewTile:resolution" = (0, 0)
        }
    }
    defaultPrim = "World"
    endTimeCode = 1000000
    metersPerUnit = 1
    startTimeCode = 0
    timeCodesPerSecond = 60
    upAxis = "Z"
)

over "Render" (
    hide_in_stage_window = true
)
{
}

def Xform "World" (
    variants = {
        string color_mode = "rrr"
        string number_of_items = "three"
    }
    prepend variantSets = ["number_of_items", "color_mode"]
)
{
    def Xform "first"
    {
        quatd xformOp:orient = (1, 0, 0, 0)
        double3 xformOp:scale = (1, 1, 1)
        double3 xformOp:translate = (0, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]
    }

    def Xform "second"
    {
        quatd xformOp:orient = (1, 0, 0, 0)
        double3 xformOp:scale = (1, 1, 1)
        double3 xformOp:translate = (0, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]
    }

    def Xform "third"
    {
        quatd xformOp:orient = (1, 0, 0, 0)
        double3 xformOp:scale = (1, 1, 1)
        double3 xformOp:translate = (0, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]
    }
    variantSet "number_of_items" = {
        "one" (
            customData = {
                string[] variantPrimPaths = ["first", "second", "third"]
            }
        ) {
            over "first" (
                prepend references = @./variant_child.usda@
            )
            {
            }

        }
        "three" (
            customData = {
                string[] variantPrimPaths = ["first", "second", "third"]
            }
        ) {
            over "first" (
                prepend references = @./variant_child.usda@
            )
            {
            }

            over "second" (
                prepend references = @./variant_child.usda@
            )
            {
            }

            over "third" (
                prepend references = @./variant_child.usda@
            )
            {
            }

        }
        "two" (
            customData = {
                string[] variantPrimPaths = ["first", "second", "third"]
            }
        ) {
            over "first" (
                prepend references = @./variant_child.usda@
            )
            {
            }

            over "second" (
                prepend references = @./variant_child.usda@
            )
            {
            }

        }
    }
    variantSet "color_mode" = {
        "rgb" (
            customData = {
                string[] variantPrimPaths = ["first", "second", "third"]
            }
        ) {
            over "first" (
                variants = {
                    string shadingVariant = "red"
                }
            )
            {
            }

            over "second" (
                variants = {
                    string shadingVariant = "red"
                }
            )
            {
            }

            over "third" (
                variants = {
                    string shadingVariant = "blue"
                }
            )
            {
            }

        }
        "rrr" (
            customData = {
                string[] variantPrimPaths = ["first", "second", "third"]
            }
        ) {
            over "first" (
                variants = {
                    string shadingVariant = "red"
                }
            )
            {
            }

            over "second" (
                variants = {
                    string shadingVariant = "red"
                }
            )
            {
            }

            over "third" (
                variants = {
                    string shadingVariant = "red"
                }
            )
            {
            }

        }
    }
}


cc @jlafleche its more complex as we are operating on references from another variant set

With the files as they are, I was indeed unable to change the colours of the spheres. And while the variant editor shows local opinion removed, it seems like it is not correctly removed for variants. Adjusting the variant_child.usda file to remove the local opinion seems to resolve the issue. Let me know whether or not this applies to your true use-case.

from variant_child.usda, remove:

variants = {
        string shadingVariant = "green"
    }

result (after adjusting rgb colours to red, green blue and shifting the spheres so all three are visible):

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.