Announcement

Collapse
No announcement yet.

reset vfb exposure to 0 via python script

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

  • reset vfb exposure to 0 via python script

    Hi,

    Is there a way to reset the exposure in the VFB via script. I got a couple of situations where i didn´t notice/forgot to reset it. It would be nice to revert this in a new session.
    Or is there a vray preference setting for that?

    Maya 2022.3 + vray 5.1

  • #2
    Which exposure are we talking about? An exposure layer or in the display correction?
    Aleksandar Hadzhiev | chaos.com
    Chaos Support Representative | contact us

    Comment


    • #3
      nevermind-i was referring to the layer
      The problem is that i sometimes dont realize i changed the exposure at some point and then when i reopen the scene i would expect it to be reset but it isnt.

      chat gpt for the win:

      import maya.mel as mel

      # Step 1: Retrieve the display correction layer ID
      disp_corr_layer_id = mel.eval('vray vfbControl -displayCorrectionLayer;')
      print("Display Correction Layer ID:", disp_corr_layer_id)

      # Step 2: Get the current exposure value
      current_exposure = mel.eval('vray vfbControl -layer {} -get "exposure";'.format(disp_corr_layer_id))
      print("Current Exposure:", current_exposure)

      # Step 3: Set the exposure value to 0.0
      mel.eval('vray vfbControl -layer {} -set "exposure" 0.0;'.format(disp_corr_layer_id))

      # Step 4: Verify the exposure value was updated
      new_exposure = mel.eval('vray vfbControl -layer {} -get "exposure";'.format(disp_corr_layer_id))
      print("New Exposure:", new_exposure)

      Comment


      • #4
        To reset the Display correction Exposure (display only) for Python:
        Code:
        import maya.cmds as cmds
        
        cmds.vray('vfbControl', '-layer', 1, '-set', "exposure", 0)​
        To reset the Exposure value of an Exposure layer, you need to find out the ID of the layer (via -listLayers and -layer <id> -name) and run this:
        Code:
        import maya.cmds as cmds
        
        cmds.vray('vfbControl', '-layer', 9, '-set', "exposure", 1)​
        More info on controlling the VFB programmatically here.​

        Originally posted by mschreck View Post
        t would be nice to revert this in a new session.Or is there a vray preference setting for that?
        Are you using a preset?​​

        EDIT: Didn't refresh the page. Let me read your last post.
        ChatGPT has a tendency to invent its own argument and property names that are not nonexistent. I doubt the code will work, but try it out.

        EDIT 2: Surprisingly, it works.
        Last edited by hermit.crab; 12-12-2024, 05:38 AM.
        Aleksandar Hadzhiev | chaos.com
        Chaos Support Representative | contact us

        Comment


        • #5
          haha, yes. ChatGPT is very creative in making up its own code if it runs into problems.
          we use a render startup script that takes care of a couple of maya and vray color and light settings etc.
          I now implemented this into the script and that way i make sure the session is always exactly the same.

          Comment

          Working...
          X