Announcement

Collapse
No announcement yet.

EXR written even if image output is disabled when outputting GI maps

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

  • EXR written even if image output is disabled when outputting GI maps

    Hi,

    I'm setting the following in Maya 2018.1 on Windows 10:


    Code:
    import maya.cmds as cmds
    import maya.mel as mel
    
    vrlmapFilepath = '//server/prod/proj2/maya/images/scene83/pre-render/vrlmap_per_frame_renderlayer1_camera1.%04d.vrlmap'
    
    cmds.setAttr('vraySettings.primaryEngine', 3) # Set Light cache (primary engine)
    cmds.setAttr('vraySettings.secondaryEngine', 0) # Disable secondary engine alltogether
    cmds.setAttr('vraySettings.mode', 0) # Set light cache mode to Single frame
    cmds.setAttr('vraySettings.autoSaveFile', vrlmapFilepath, type='string') # Set path to vrlmap file
    cmds.setAttr('vraySettings.autoSave', 1) # Enable autosave of vrlmap file
    cmds.setAttr('vraySettings.globopt_gi_dontRenderImage', 1) # Disable final image rendering
    cmds.setAttr('vraySettings.sys_distributed_rendering_on', 0) # Disable DR

    1. EXR is written although "Don't render final image" is enabled
    Although I just want to render out the vrlmap, the multichannel EXR is also written out (V-Ray 3.60.02). Do you see this on your end too?
    It would be great if the EXR was not written.

    2. Did the autosave attribute name change?
    With the code snippet above, vrlmaps are generated as expected. But I notice that when setting vraySettings.autoSaveFile like above, the filepath is not visibly entered into the render globals UI. If I edit this attribute in the render globals UI by hand (not by code) I see the following being outputted to the script editor:
    Code:
    setAttr -type "string" vraySettings.lc_autoSaveFile "test.vrlmap";
    - and so it seems this attribute name has changed from "vraySettings.autoSaveFile" to "vraySettings.lc_autoSaveFile". Is this correct? Should I be using vraySettings.lc_autoSaveFile instead of vraySettings.autoSaveFile?
    - Do you know for which V-Ray for Maya version this was changed?
    Last edited by Fredrik Averpil; 15-11-2017, 01:57 AM.
    Best Regards,
    Fredrik

  • #2
    Regarding my second question (2.), here's a screenshot (from V-Ray 3.30) showing the vraySettings attributes "vraySettings.autoSaveFile" and "vraySettings.lc_autoSaveFile".
    Best Regards,
    Fredrik

    Comment


    • #3
      Looking into it now. I think we changed it back in september 2014 (around when 3.0 came out) and that's why there's two attributes. The newer one is the one we currently use and we added it to allow support for <tags> in the filepaths and filenames. Our code should do a sync between the two if needed (I think), but it would be best if you used the newer one just to stay on the safe side. So the "lc_" prefixed attribute is the one you want. Looking into the other issues now.
      Alex Yolov
      Product Manager
      V-Ray for Maya, Chaos Player
      www.chaos.com

      Comment


      • #4
        Hmm, The other thing seems to be a bug, it also affects .vrimg. I'll add a ticket to our bug-tracker.
        In my tests, a possible workaround is to also enable "don't save image" (setAttr vraySettings.dontSaveImage 1) along with "don't render final image"
        Last edited by yolov; 15-11-2017, 05:33 AM.
        Alex Yolov
        Product Manager
        V-Ray for Maya, Chaos Player
        www.chaos.com

        Comment


        • #5
          Hi Yolov,

          When also setting vraySettings.dontSaveImage, the EXR is still written, so that workaround did not work for me.

          I just tried using only the "lc_" prefixed attribute for the filepath. What's funny is when I use that path with V-Ray 3.60.02 is, no vrlmap is written at all!

          Code:
          [2017/Nov/15|14:30:21] V-Ray: Saving light cache to file "/home/iruser/maya/projects/"...
          [2017/Nov/15|14:30:21] V-Ray error: Error saving light cache
          When I execute the command in the Maya UI I can see that the attribute field is not populated with anything and remains empty.
          But if I use the older attribute, the vrlmap is rendered. Do you see this on your end too?

          You should be able to repro this by opening up Maya 2018.1 + V-Ray 3.60.02 official and executing the following:

          Code:
          """Light cache map WRITE pre-render script"""
          
          import maya.cmds as cmds
          import maya.mel as mel
          
          
          vrlmapFilepath = '//server/prod/proj2/maya/images/scene83/pre-render/vrlmap_precalc_per_frame_greenlayer_camera1.%04d.vrlmap'
          
          cmds.setAttr('vraySettings.primaryEngine', 3) # Set Light cache (primary engine)
          cmds.setAttr('vraySettings.secondaryEngine', 0) # Disable secondary engine alltogether
          cmds.setAttr('vraySettings.mode', 0) # Set light cache mode to Single frame
          
          # This actually does work (if uncommented)
          # cmds.setAttr('vraySettings.autoSaveFile', vrlmapFilepath, type='string') # Set path to vrlmap file (legacy)
          
          # Oddly enough, the below autosave cmd does not seem to set the value in Render Globals and doesn't work in batch render mode
          cmds.setAttr('vraySettings.lc_autoSaveFile', vrlmapFilepath, type='string') # Set path to vrlmap file
          
          cmds.setAttr('vraySettings.autoSave', 1) # Enable autosave of vrlmap file
          cmds.setAttr('vraySettings.globopt_gi_dontRenderImage', 1) # Disable final image rendering
          cmds.setAttr('vraySettings.sys_distributed_rendering_on', 0) # Disable DR
          - Is the "lc_ ..." attribute field empty in your Maya UI as well after having executed the above code?
          Last edited by Fredrik Averpil; 15-11-2017, 06:42 AM.
          Best Regards,
          Fredrik

          Comment


          • #6
            That's odd - the "don't save image" part works fine here.
            As for the light cache's auto save path, paying more attention to it now - and it seems that there's something broken, I can confirm that. But I also get the same bug with the legacy attribute (the one that's not lc_ prefixed).

            You could try a post-translate python script to make sure the correct parameter is set (since this actually edits the vray plugins' parameters after the scene is exported to memory).
            Code:
            from vray.utils import *
            
            vrlmapFilepath='C:/Users/yolov/Desktop/giwriteout/test.<frame04>.vrlmap'
            
            slc=findByType('SettingsLightCache')[0]
            slc.set('mode', 0) # Set light cache mode to Single frame
            slc.set('auto_save', 1) # Enable autosave
            slc.set('auto_save_file', vrlmapFilepath) # Set path to vrlmap file
            
            #"hack" to disable image write-out
            #basically forces an empty string for image name, which disables the vray image writer
            so=findByType('SettingsOutput')[0]
            so.set('img_file', '')
            Note that in the post-translate I've used the <frame0n> formatting, instead of %0nd. Setting %0nd in the UI will automatically update it to the newer format.
            Hope that this works as a workaround. I'll see what's broken in the UI, I already suspect what it is and I think it's not going to be hard to fix.
            Alex Yolov
            Product Manager
            V-Ray for Maya, Chaos Player
            www.chaos.com

            Comment


            • #7
              Actually, one more thing - by setting the attribute and when it doesn't show anything in the field for you, what happens if you do a getAttr ?
              Alex Yolov
              Product Manager
              V-Ray for Maya, Chaos Player
              www.chaos.com

              Comment


              • #8
                Aaaand one more thing. Can you try reworking your initial script to use the <frame0n> format instead of %0nd? I think this is where things get funky and it "should" work fine with <frame0n>. The auto-update for the formatting gets weird when script-accessing the attribute. There's a slightly separate code that does the update if the value is passed from the "browse". It might explain everything we've seen so far.
                Replacing the frame tag formatting in your script does the trick on my end, which means that there will be no need to use post-translate python.
                Alex Yolov
                Product Manager
                V-Ray for Maya, Chaos Player
                www.chaos.com

                Comment


                • #9
                  Ok, cool, I can now use the "lc_" attribute when changing the padding in my filepath from %04d to <frame04>. Did this padding change happen back in 2014 as well?



                  That's odd - the "don't save image" part works fine here.
                  What exactly are you doing in order to get the EXR not to be written?
                  I'm rendering on the commandline (not in Maya UI or with VFB), and is providing a -preRender argument with a MEL script which launches the Python commands.
                  Filename prefix is: <Scene>_<Layer>_<Camera>.
                  Animation is enabled, rendering frame 1-1.
                  Scene attached: scene83.zip

                  Code:
                  """Light cache map WRITE pre-render script"""
                  
                  import maya.cmds as cmds
                  import maya.mel as mel
                  
                  
                  vrlmapFilepath = '//server/prod/proj2/maya/images/scene83/pre-render/vrlmap_precalc_per_frame_greenlayer_camera1.<frame04>.vrlmap'
                  
                  cmds.setAttr('vraySettings.primaryEngine', 3) # Set Light cache (primary engine)
                  cmds.setAttr('vraySettings.secondaryEngine', 0) # Disable secondary engine alltogether
                  cmds.setAttr('vraySettings.mode', 0) # Set light cache mode to Single frame
                  cmds.setAttr('vraySettings.lc_autoSaveFile', vrlmapFilepath, type='string') # Set path to vrlmap file
                  cmds.setAttr('vraySettings.globopt_gi_dontRenderImage', 1) # Disable final image rendering
                  cmds.setAttr('vraySettings.dontSaveImage', 1)  # Don't save image
                  cmds.setAttr('vraySettings.sys_distributed_rendering_on', 0) # Disable DR


                  ... what happens if you do a getAttr ?
                  Code:
                  >>> vrlmapFilepath_legacy = '//server/prod/proj2/maya/images/scene83/pre-render/vrlmap_precalc_per_frame_greenlayer_camera1.%04d.vrlmap'
                  >>> cmds.setAttr('vraySettings.autoSaveFile', vrlmapFilepath_legacy, type='string') # Set path to vrlmap file (legacy)
                  >>> x = cmds.getAttr('vraySettings.autoSaveFile')
                  >>> print(x)
                  //server/prod/proj2/maya/images/scene83/pre-render/vrlmap_precalc_per_frame_greenlayer_camera1.<frame04>.vrlmap
                  So it seems that does work even if the UI is showing nothing in the attribute field.
                  Attached Files
                  Best Regards,
                  Fredrik

                  Comment


                  • #10
                    Should <frame04> be used (instead of %04d) for irradiance map filepath as well (vraySettings.imap_autoSaveFile)?
                    Best Regards,
                    Fredrik

                    Comment


                    • #11
                      The "don't save image" option is ignored in command-line renders, that's why it doesn't work, but then again it's still a bug that an exr is written out when "don't render final image" is enabled.
                      You could still go around this by passing an empty string to SettingsOutput::img_file with post-translate python.

                      The frame tag was changed back in 2014, yes. It would be best to use the new tags anywhere that keywords/tags can be used, which basically means all the string fields in the render settings (vray.settings).
                      Alex Yolov
                      Product Manager
                      V-Ray for Maya, Chaos Player
                      www.chaos.com

                      Comment


                      • #12
                        Ok, thanks for confirming.
                        All good. We'll just be careful about the EXR being written and update to a build whenever this gets addressed.

                        Cheers for all the very useful help, Alex!
                        Last edited by Fredrik Averpil; 16-11-2017, 05:52 AM. Reason: Realized your first name is Alex, not Yolov!
                        Best Regards,
                        Fredrik

                        Comment


                        • #13
                          Try the post-translate I posted above, it should do the job until we fix it.


                          Code:
                          from vray.utils import *
                          
                          so=findByType('SettingsOutput')[0]
                          so.set('img_file', '')
                          Alex Yolov
                          Product Manager
                          V-Ray for Maya, Chaos Player
                          www.chaos.com

                          Comment


                          • #14
                            Oh yeah, that worked nicely. Thanks!
                            Best Regards,
                            Fredrik

                            Comment

                            Working...
                            X