Announcement

Collapse
No announcement yet.

Maxscript and Render Elements Question

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

  • Maxscript and Render Elements Question

    I´m a bit stuck with Maxscript and RenderElements. The basic idea is to render 5 frames, each with a different camera
    objects and lights.
    The script looks like this.

    -----
    sMTLRsl = "\\"
    sMTLRsq1 = "cam1"
    sMTLRsq2 = "cam2"
    sMTLRsq3 = "cam3"
    sMTLRsq4 = "cam4"
    sMTLRsq5 = "cam5"
    sMTLRfo = ".tga"

    render outputfile: ("c:\\temp" + sMTLRsl + "test" + sMTLRsq1 + sMTLRfo) renderElements:true frame:0

    render outputfile: ("c:\\temp" + sMTLRsl + "test" + sMTLRsq2 + sMTLRfo) renderElements:true frame:1

    render outputfile: ("c:\\temp" + sMTLRsl + "test" + sMTLRsq3 + sMTLRfo) renderElements:true frame:2

    render outputfile: ("c:\\temp" + sMTLRsl + "test" + sMTLRsq4 + sMTLRfo) renderElements:true frame:3

    render outputfile: ("c:\\temp" + sMTLRsl + "test" + sMTLRsq5 + sMTLRfo) renderElements:true frame:4
    -----

    This will render out 5 frames to c:/temp/
    The problem is, it writes out the render elements only for the last frame rendered.
    If you want to test it. Create a new scene. Turn VFB off. For some reason no render element is written out when the VFB is on.
    Add a render element and execute the script. The problem as far as I can see. When I add a render element I don´t add an explicit output path
    for the element nor a path for the complete rendering in the render dialogue. Because this is what the script should do.
    When I execute the script the output path of the first frame rendered is set as path for the renderelement in the render setup window.
    This file is than overwritten by each new rendering. Is there some way to clear the output path of a render element with maxscript.
    Or maybe any other idea how to get around this is much appreciated.

  • #2
    Yeah, the logic behind render elements can be a bit nebulous at times. Try this:

    Code:
    -- get the state of the render dialog
    bRDOpen = renderSceneDialog.isOpen()
    
    -- if open then close
    if bRDOpen == true do renderSceneDialog.close()
    
    -- set the file out, then render, REs will update
    rendOutputFilename = @"c:\temp\temp3.tga"
    
    -- if open, open again 
    if bRDOpen == true do renderSceneDialog.open()
    Basically you set the render output in the dialog before rendering instead of rendering through a supplied output string only. And yes enabling the VRay VFB will disable separate (max) render element output.

    Edit: To clarify, you need to set the path in the render dialog first, then use the same path in the render() command. Make sure the render dialog is closed, otherwise the settings won't stick.

    Edit2: Hm, no, still doesn't save the REs.
    Last edited by Rens; 20-02-2015, 03:21 AM.
    Rens Heeren
    Generalist
    WEBSITE - IMDB - LINKEDIN - OSL SHADERS

    Comment


    • #3
      Ok, this works, it's very slow when rendering quick frames though as it will open and close the render dialog to bake in the settings...

      Code:
      
      sMTLRsl = "\\"
      sMTLRsq1 = "cam1"
      sMTLRsq2 = "cam2"
      sMTLRsq3 = "cam3"
      sMTLRsq4 = "cam4"
      sMTLRsq5 = "cam5"
      sMTLRfo = ".tga"
      
      renderSceneDialog.close()
      
      sOut = "c:\\temp" + sMTLRsl + "test" + sMTLRsq1 + sMTLRfo
      rendOutputFilename = sOut
      renderSceneDialog.open()
      renderSceneDialog.close()
      render outputfile:sOut renderElements:true frame:0
      
      sOut = "c:\\temp" + sMTLRsl + "test" + sMTLRsq2 + sMTLRfo
      rendOutputFilename = sOut
      renderSceneDialog.open()
      renderSceneDialog.close()
      render outputfile:sOut renderElements:true frame:1
      
      sOut = "c:\\temp" + sMTLRsl + "test" + sMTLRsq3 + sMTLRfo
      rendOutputFilename = sOut
      renderSceneDialog.open()
      renderSceneDialog.close()
      render outputfile:sOut renderElements:true frame:2
      
      sOut = "c:\\temp" + sMTLRsl + "test" + sMTLRsq4 + sMTLRfo
      rendOutputFilename = sOut
      renderSceneDialog.open()
      renderSceneDialog.close()
      render outputfile:sOut renderElements:true frame:3
      
      sOut = "c:\\temp" + sMTLRsl + "test" + sMTLRsq5 + sMTLRfo
      rendOutputFilename = sOut
      renderSceneDialog.open()
      renderSceneDialog.close()
      render outputfile:sOut renderElements:true frame:4
      Rens Heeren
      Generalist
      WEBSITE - IMDB - LINKEDIN - OSL SHADERS

      Comment


      • #4
        Thank You very much ! This works well. It doesn´t matter when it takes a second to open and close.
        Having the Render dialogue open seems to cause various problems. For example changing the output size by script also won´t work
        if it´s open, too.

        Comment


        • #5
          You're welcome! Yeah setting render dialog settings is done best with the dialog closed.
          Rens Heeren
          Generalist
          WEBSITE - IMDB - LINKEDIN - OSL SHADERS

          Comment

          Working...
          X