Announcement

Collapse
No announcement yet.

Script Callbacks Between Rendered Frames?

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

  • Script Callbacks Between Rendered Frames?

    Hi, I'm trying to execute a script between each frame when rendering a sequence, but the usual 3dsmax callbacks aren't working. I've tried
    Code:
    [B]callbacks.addScript #postRenderFrame[/B]
    and
    Code:
    [B]callbacks.addScript [/B][B]#preRenderFrame[/B]
    , but neither calls mid-sequence: only at the beginning or end of the entire sequence being rendered. Is there another way to approach this that's vray-specific?

  • #2
    Code:
    fn myCallback = print "hello"
    callbacks.addScript #prerenderframe myCallback id:#myPRFCallback
    This prints out at each frame of a rendered sequence for me.
    #prerenderframe callbacks have certain limitations, what isn't working for you?
    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


    • #3
      Ah, thanks for confirming that it should be working! I added a few more "print" calls to help debug, and discovered I was removing the callback prematurely.

      Edit: also discovered that currentTime.frame does not change between each frame, and always returns the first frame number of the sequence being rendered.
      Last edited by jamie_galimberti; 23-02-2022, 10:42 AM.

      Comment


      • #4
        That too works for me.
        Code:
        fn myCallback = print (currentTime.frame as string)
        callbacks.addScript #prerenderframe myCallback id:#myPRFCallback
        This prints me out the float value for each rendered frame.
        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


        • #5
          Interesting. When I tried the following, all I ever got was "0000":
          Code:
          f = formattedPrint currentTime.frame format:"04d"
          print f
          Alternatively, when I just create my own variable and increment it, I get the desired output:
          Code:
          frameStart = 0;
          frameSkip = 10;
          
          function saveIRM =
          (
              f = formattedPrint frameStart format:"04d"
              print f
              irmPath = "v:\\IRM\\irm"+f+".vrmap"
              vr=renderers.current
              vr.saveIrradianceMap(irmPath)
              frameStart = frameStart + frameSkip
          )
          There's certainly some nuances of MaxScript that slip past me.

          Comment

          Working...
          X