Announcement

Collapse
No announcement yet.

Control VFB OCIO settings from Python

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Control VFB OCIO settings from Python

    We really need to be able to control the OCIO settings of the VFB from Python inside Houdini. Depending on what Task we are in the we need to set different viewers and potentially displays and etc.

    I managed to get the vfb object from the vray_renderer object and then get the current settings with getLayers. But after modifying the json and then using setLayers to get the new settings in nothing happens.

    It appears to get the Layers from the ROP node in some way but I can't figure out which parameter on the ROP or how to modify it.

    -- Erik

  • #2
    There is a "_vfb2_layers" parameter after evaluating it it looks to be encrypted or scrambled in some way instead of looking like get json you get back from getLayers

    -- Erik

    Comment


    • #3
      It's in base64, I guess there are some Python functions to encode/decode this.
      V-Ray For Houdini | V-Ray Hydra Delegate | VRayScene
      andrei.izrantcev@chaos.com
      Support Request

      Comment


      • #4
        I can decode it using base64 but after modifying the ocio_viewtransform value and encoding it back to base64. When i set the base64 value it does not change the view transform. Neither while vfb is open or reopening it from the rop

        Comment


        • #5
          Code:
          def dict_to_base64(settings):
             message = json.dumps(settings)
             message_encoded = base64.b64encode(message)
             return message_encoded
          
          
          def base64_to_dict(base64_message):
             message_decoded = base64.b64decode(base64_message)
             return json.loads(message_decoded)
          
          
          def get_vfb_settings(node):
             parm_value = node.parm(vfb_layers_parm).eval()
             return base64_to_dict(parm_value)
          
          
          def set_default_vfb_properties(node):
             node.parm(vfb_layers_parm).set(dict_to_base64(vfb_default_layer_settings))
          This is what I tried
          vfb_default_layer_settings is a dict containing a dump of what was in there after opening the vfb a single time. It's empty before any vfb has been opened from the ROP

          Comment


          • #6
            Hi Erik,

            could you elaborate how you managed to get the vfb object from the vray_renderer?
            I was only able to get a vfb object that wasn't linked to the renderer and thus it didn't contain any settings.
            Maybe you can post a few lines of code?

            Thanks and best,
            Holger

            Comment


            • #7
              Also registering my interest in this. It's easy for artists to accidentally start lighting a shot with the wrong vfb setup.

              Comment


              • #8
                Also interested in this. I find it gets reset from time to time and being able to script a button that will set it to my preference would be very useful. Also +1 for the ability for a studio's pipleline to be able to set it according to show/shot/task etc.

                Comment


                • #9
                  Originally posted by lloydwood View Post
                  Also interested in this. I find it gets reset from time to time and being able to script a button that will set it to my preference would be very useful. Also +1 for the ability for a studio's pipleline to be able to set it according to show/shot/task etc.
                  Haven't checked on if it is possible to do it through python yet but the environment variable approach is working good so we set it up in our environment handler.
                  The variables we set are:
                  Code:
                  # enable ocio
                  VRAY_VFB_OCIO="1"
                  # turn off srgb curve
                  VRAY_VFB_SRGB="2"
                  # Set a specific view transform
                  VRAY_VFB_OCIO_VIEW_TRANSFORM=view_transform_to_use
                  Hopefully this helps

                  Comment


                  • #10
                    Originally posted by celluloid_vfx View Post
                    Hi Erik,

                    could you elaborate how you managed to get the vfb object from the vray_renderer?
                    I was only able to get a vfb object that wasn't linked to the renderer and thus it didn't contain any settings.
                    Maybe you can post a few lines of code?

                    Thanks and best,
                    Holger
                    Unfortunately I never managed to get any VFB object and was purely trying to manipulate the settings that was stored on the ROP. The idea was to add a OnCreated script that configured it correctly

                    Comment

                    Working...
                    X