Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different behavior regarding primvars with namespaces between kick and htoa #1607

Closed
cchampet opened this issue Aug 1, 2023 · 3 comments · Fixed by #1608
Closed

Different behavior regarding primvars with namespaces between kick and htoa #1607

cchampet opened this issue Aug 1, 2023 · 3 comments · Fixed by #1608
Assignees
Labels
bug Something isn't working

Comments

@cchampet
Copy link

cchampet commented Aug 1, 2023

Hi there,

Describe the bug
We have discovered a different behavior between htoa and kick regarding the primvars.
In our USD, a primvar named sps:my_primvar drives a switch_rgba in the arnold material builder.
The expected color assigned to the cube is green.
This primvar is correctly read if we load the USD in Houdini (using a sublayer node) and render it with htoa.
But it is ignored when I use kick (the color is red, which corresponds to the fallback value of the userdata node).

To Reproduce
Steps to reproduce the behavior:

  1. write this content as output.usda on disk:
#usda 1.0
(
    endTimeCode = 1001
    framesPerSecond = 24
    metersPerUnit = 1
    startTimeCode = 1001
    timeCodesPerSecond = 24
    upAxis = "Y"
)

def Xform "world"
{
    def Xform "geo"
    {
        int primvars:sps:my_primvar = 1 (
            interpolation = "constant"
        )

        def Cube "cube1" (
            prepend apiSchemas = ["MaterialBindingAPI"]
        )
        {
            float3[] extent = [(-1, -1, -1), (1, 1, 1)]
            rel material:binding = </world/mtl/my_shader_mtl>
            double size = 2
            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 Scope "mtl"
    {
        def Material "my_shader_mtl"
        {
            token outputs:arnold:surface.connect = </world/mtl/my_shader_mtl/my_shader_shd.outputs:shader>
            token outputs:surface.connect = </world/mtl/my_shader_mtl/my_shader_prv.outputs:surface>

            def Shader "my_shader_prv"
            {
                uniform token info:id = "UsdPreviewSurface"
                color3f inputs:diffuseColor.connect = </world/mtl/my_shader_mtl/usdprimvarreader1.outputs:result>
                token outputs:surface
            }

            def Shader "usdprimvarreader1"
            {
                uniform token info:id = "UsdPrimvarReader_int"
                string inputs:varname = "sps:my_primvar"
                int outputs:result
            }

            def Shader "my_shader_shd"
            {
                uniform token info:id = "arnold:standard_surface"
                string inputs:aov_id1 = ""
                string inputs:aov_id2 = ""
                string inputs:aov_id3 = ""
                string inputs:aov_id4 = ""
                string inputs:aov_id5 = ""
                string inputs:aov_id6 = ""
                string inputs:aov_id7 = ""
                string inputs:aov_id8 = ""
                float inputs:base = 1
                color3f inputs:base_color = (0.8, 0.8, 0.8)
                color3f inputs:base_color.connect = </world/mtl/my_shader_mtl/switch_rgba1.outputs:rgba>
                bool inputs:caustics = 0
                float inputs:coat = 0
                float inputs:coat_affect_color = 0
                float inputs:coat_affect_roughness = 0
                float inputs:coat_anisotropy = 0
                color3f inputs:coat_color = (1, 1, 1)
                float inputs:coat_IOR = 1.5
                vector3f inputs:coat_normal = (0, 0, 0)
                float inputs:coat_rotation = 0
                float inputs:coat_roughness = 0.1
                int inputs:dielectric_priority = 0
                float inputs:diffuse_roughness = 0
                float inputs:emission = 0
                color3f inputs:emission_color = (1, 1, 1)
                bool inputs:exit_to_background = 0
                color3f inputs:id1 = (0, 0, 0)
                color3f inputs:id2 = (0, 0, 0)
                color3f inputs:id3 = (0, 0, 0)
                color3f inputs:id4 = (0, 0, 0)
                color3f inputs:id5 = (0, 0, 0)
                color3f inputs:id6 = (0, 0, 0)
                color3f inputs:id7 = (0, 0, 0)
                color3f inputs:id8 = (0, 0, 0)
                float inputs:indirect_diffuse = 1
                float inputs:indirect_specular = 1
                bool inputs:internal_reflections = 1
                float inputs:metalness = 0
                vector3f inputs:normal = (0, 0, 0)
                color3f inputs:opacity = (1, 1, 1)
                float inputs:sheen = 0
                color3f inputs:sheen_color = (1, 1, 1)
                float inputs:sheen_roughness = 0.3
                float inputs:specular = 1
                float inputs:specular_anisotropy = 0
                color3f inputs:specular_color = (1, 1, 1)
                float inputs:specular_IOR = 1.5
                float inputs:specular_rotation = 0
                float inputs:specular_roughness = 0.2
                float inputs:subsurface = 0
                float inputs:subsurface_anisotropy = 0
                color3f inputs:subsurface_color = (1, 1, 1)
                color3f inputs:subsurface_radius = (1, 1, 1)
                float inputs:subsurface_scale = 1
                token inputs:subsurface_type = "randomwalk"
                vector3f inputs:tangent = (0, 0, 0)
                float inputs:thin_film_IOR = 1.5
                float inputs:thin_film_thickness = 0
                bool inputs:thin_walled = 0
                float inputs:transmission = 0
                color3f inputs:transmission_color = (1, 1, 1)
                float inputs:transmission_depth = 0
                float inputs:transmission_dispersion = 0
                float inputs:transmission_extra_roughness = 0
                color3f inputs:transmission_scatter = (0, 0, 0)
                float inputs:transmission_scatter_anisotropy = 0
                bool inputs:transmit_aovs = 0
                token outputs:shader
            }

            def Shader "switch_rgba1"
            {
                uniform token info:id = "arnold:switch_rgba"
                int inputs:index = 0
                int inputs:index.connect = </world/mtl/my_shader_mtl/user_data_int1.outputs:int>
                color4f inputs:input0 = (0, 0, 0, 1)
                color4f inputs:input0.connect = </world/mtl/my_shader_mtl/color_convert1.outputs:rgb>
                color4f inputs:input1 = (0, 0, 0, 1)
                color4f inputs:input1.connect = </world/mtl/my_shader_mtl/color_convert2.outputs:rgb>
                color4f inputs:input2 = (0, 0, 0, 1)
                color4f inputs:input2.connect = </world/mtl/my_shader_mtl/color_convert3.outputs:rgb>
                color4f inputs:input3 = (0, 0, 0, 1)
                color4f inputs:input4 = (0, 0, 0, 1)
                color4f inputs:input5 = (0, 0, 0, 1)
                color4f inputs:input6 = (0, 0, 0, 1)
                color4f inputs:input7 = (0, 0, 0, 1)
                color4f inputs:input8 = (0, 0, 0, 1)
                color4f inputs:input9 = (0, 0, 0, 1)
                color4f inputs:input10 = (0, 0, 0, 1)
                color4f inputs:input11 = (0, 0, 0, 1)
                color4f inputs:input12 = (0, 0, 0, 1)
                color4f inputs:input13 = (0, 0, 0, 1)
                color4f inputs:input14 = (0, 0, 0, 1)
                color4f inputs:input15 = (0, 0, 0, 1)
                color4f inputs:input16 = (0, 0, 0, 1)
                color4f inputs:input17 = (0, 0, 0, 1)
                color4f inputs:input18 = (0, 0, 0, 1)
                color4f inputs:input19 = (0, 0, 0, 1)
                color3f outputs:rgba
            }

            def Shader "user_data_int1"
            {
                uniform token info:id = "arnold:user_data_int"
                string inputs:attribute = "sps:my_primvar"
                int inputs:default = 0
                int outputs:int
            }

            def Shader "color_convert1"
            {
                uniform token info:id = "arnold:color_convert"
                token inputs:from = "RGB"
                color3f inputs:input = (1, 0, 0)
                token inputs:to = "RGB"
                color3f outputs:rgb
            }

            def Shader "color_convert2"
            {
                uniform token info:id = "arnold:color_convert"
                token inputs:from = "RGB"
                color3f inputs:input = (0, 1, 0)
                token inputs:to = "RGB"
                color3f outputs:rgb
            }

            def Shader "color_convert3"
            {
                uniform token info:id = "arnold:color_convert"
                token inputs:from = "RGB"
                color3f inputs:input = (0, 0, 1)
                token inputs:to = "RGB"
                color3f outputs:rgb
            }
        }
    }

    def Xform "lgt"
    {
        def DomeLight "domelight1" (
            prepend apiSchemas = ["HoudiniViewportGuideAPI"]
        )
        {
            rel filters = None
            float houdini:guidescale = 1
            bool houdini:inviewermenu = 0
            color3f inputs:color = (1, 1, 1)
            float inputs:diffuse = 1
            bool inputs:enableColorTemperature = 0
            float inputs:exposure = 0
            float inputs:intensity = 1
            bool inputs:normalize = 0
            float inputs:specular = 1
            asset inputs:texture:file = @@
            token inputs:texture:format = "automatic"
            rel portals = None
            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 Xform "cam"
    {
        def Camera "camera" (
            prepend apiSchemas = ["HoudiniCameraPlateAPI", "HoudiniViewportGuideAPI"]
        )
        {
            float2 clippingRange = (0.12344074, 18880.2)
            float exposure = 0
            float focalLength = 0.5
            float focusDistance = 5
            float fStop = 0
            float horizontalAperture = 0.5
            float horizontalApertureOffset = 0
            asset houdini:backgroundimage = @@
            asset houdini:foregroundimage = @@
            float houdini:guidescale = 1
            bool houdini:inviewermenu = 1
            token projection = "perspective"
            double shutter:close = 0.25
            double shutter:open = -0.25
            float verticalAperture = 0.28125
            float verticalApertureOffset = 0
            matrix4d xformOp:transform = ( (0.7922166698598341, 2.775557561562863e-17, -0.6102399101961413, 0), (-0.14402974414210445, 0.9717478312466528, -0.1869801734670998, 0), (0.5929993092732525, 0.23602150848477096, 0.7698348308137393, 0), (7.8631174214859385, 3.5107257914239365, 13.192287350691798, 1) )
            uniform token[] xformOpOrder = ["xformOp:transform"]
        }
    }
}
  1. kick output.usda -nostdin -dp -frame 1001 -as 1 -v 6 -asmax 1 -r 512 512

Expected behavior
Constant interpolation primvar values should be inherited down namespace, also for primvars with namespace.
@cpichard already helped us on this issue, and it seems to be linked to this peace of code:

if (primvar.NameContainsNamespaces())

Used Software Versions

  • Arnold 7.1.3.0
  • htoa-6.1.3.1

Thank you for your amazing work!
Clement

@cchampet cchampet added the bug Something isn't working label Aug 1, 2023
@autodesk-oss-arnold-bot
Copy link

Issue synced internally to ARNOLD-13863

@autodesk-oss-arnold-bot
Copy link

Issue synced internally to ARNOLD-13954

@autodesk-oss-arnold-bot
Copy link

Issue synced internally to ARNOLD-13975

@github-project-automation github-project-automation bot moved this from Todo to Done in Arnold USD Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants