Announcement

Collapse
No announcement yet.

Setting Vray Frame Buffer via Maxscript

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

  • Setting Vray Frame Buffer via Maxscript

    I maybe wrong about this but I can't seem to find a reference for setting the size of the Vray Frame Buffer via maxscript.
    I can set the output size of the image but how do I resize the existing frame buffer?

    The reason I need to do it is I want to set the vray region with a script, this works well if the region is smaller than the current size of the frame buffer but doesn't set correctly if the region is bigger or some part of it is outside the current frame buffer resolution.
    Example:
    Current Frame buffer size: 640x480 output size: 640x480 region: (0 0 200 200) this works fine
    Current Frame buffer size: 640x480 output size: 1500x1500 region: (1000 1000 1500 1500) this will not be set properly as the region coordinates are outside the current buffer size

    When you hit render the vray frame buffer automatically resizes to the output size and after that you can set the right region render coordinates.




  • #2
    Hello!

    Thank yoy for reporting this case. Unfortunately, we don't have a maxscript command for setting the VFB frame size.
    The proper handling here would be to enhance the setregion command so that it reads correctly the render output size from render setup and not conform to the default VFB frame resolution. I logged this issue in our bug tracking system (the exact issue number is VMAX-8896).
    I can suggest this workaround until we fix it:
    Load some image with proper resolution (you don't even need to open VFB), clear VFB and then set the region.
    Code:
    vfbControl #loadimage "D:\\del\\black1500x1500.png"
    vfbControl #clearimage
    vfbControl #setregion 1000 1000 1500 1500
    It's not an elegant solution. You should also have in mind that the image you load needs to have the exact resolution as your render output (else the render region will scale).

    Best regards,
    Margarita
    Margarita Stoeva | chaos.com
    Chaos QA (V-Ray for 3ds Max)

    Comment


    • #3
      Hi Margarita,
      thanks I came to the same un-elegant conclusion as well.

      Here is a function for anyone else who is looking
      Code:
      fn setVFBSize _w _h setVFBRegion: = 
          (
              -- Workaround for setting the size of the vray frame buffer by loading the right size image into it.
      
              local vraySizeBitmap = bitmap _w _h color:black filename:((getdir #temp)+"\\vraySizeBitmap.jpg")
              save vraySizeBitmap
              close vraySizeBitmap
              vfbControl #loadimage vraySizeBitmap.filename    
              deletefile vraySizeBitmap.filename
              free vraySizeBitmap
              vfbControl #clearimage
      
              if setVFBRegion != unsupplied then (vrayVFBSetRegion setVFBRegion[1] setVFBRegion[2] setVFBRegion[3] setVFBRegion[4])
      
          )
      --use
      setVFBSize 1000 1000 setVFBRegion:#(0, 0, 500, 500)
      
      --for no region just resize
      setVFBSize 1000 1000

      Comment


      • #4
        Wow!
        Thank you for sharing!
        Margarita Stoeva | chaos.com
        Chaos QA (V-Ray for 3ds Max)

        Comment


        • #5
          Originally posted by ILS View Post
          Hi Margarita,
          thanks I came to the same un-elegant conclusion as well.

          Here is a function for anyone else who is looking
          Code:
          fn setVFBSize _w _h setVFBRegion: =
          (
          -- Workaround for setting the size of the vray frame buffer by loading the right size image into it.
          
          local vraySizeBitmap = bitmap _w _h color:black filename:((getdir #temp)+"\\vraySizeBitmap.jpg")
          save vraySizeBitmap
          close vraySizeBitmap
          vfbControl #loadimage vraySizeBitmap.filename
          deletefile vraySizeBitmap.filename
          free vraySizeBitmap
          vfbControl #clearimage
          
          if setVFBRegion != unsupplied then (vrayVFBSetRegion setVFBRegion[1] setVFBRegion[2] setVFBRegion[3] setVFBRegion[4])
          
          )
          --use
          setVFBSize 1000 1000 setVFBRegion:#(0, 0, 500, 500)
          
          --for no region just resize
          setVFBSize 1000 1000
          ahah, nice hack, well thought out!
          Lele
          Trouble Stirrer in RnD @ Chaos
          ----------------------
          emanuele.lecchi@chaos.com

          Disclaimer:
          The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

          Comment

          Working...
          X