Announcement

Collapse
No announcement yet.

Script Start Simulator on Given Frame Ranges

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

  • Script Start Simulator on Given Frame Ranges

    Hi,

    I need to start the simulator for example on frames 15-30, then on frames 60-75, and so on on different sections of the timeline.

    Is there a script example to do this ?


    I am not very versed on MaxScript and even though this might be simple I cannot really wrap my head around a correct way of writing the script.

    If anyone can share some sample code I would be most grateful.


    Thank you !

    -P
    i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

  • #2
    Hey,

    Check this out If you just change PhoenixFDLiquid001 with the name of your simulator it should work.

    sim = getnodebyname "PhoenixFDLiquid001"
    select sim
    $.start_from_timeline = off
    $.stop_from_timeline = off
    $.startframe = 15
    $.stopframe = 30
    A_StartSim sim
    A_Wait sim
    $.startframe = 60
    $.stopframe = 75
    A_StartSim sim
    A_Wait sim

    Hope this helps!
    Georgi Zhekov
    Phoenix Product Manager
    Chaos

    Comment


    • #3
      Originally posted by georgi.zhekov View Post
      Hey,

      Check this out If you just change PhoenixFDLiquid001 with the name of your simulator it should work.

      sim = getnodebyname "PhoenixFDLiquid001"
      select sim
      $.start_from_timeline = off
      $.stop_from_timeline = off
      $.startframe = 15
      $.stopframe = 30
      A_StartSim sim
      A_Wait sim
      $.startframe = 60
      $.stopframe = 75
      A_StartSim sim
      A_Wait sim

      Hope this helps!
      You're awesome Georgi, thank you !
      i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

      Comment


      • #4
        This is almost working

        Once the first range of frames is done simulating (which it does properly) it starts simulating the next range of frames but it only simulates the first frame from the second range and then it keeps on simulating and overriding the same frame over and over, I just see the modified timestamp change but it's the same frame.


        Here's the script:

        sim = getnodebyname "PhoenixFDFire001"
        select sim
        $.start_from_timeline = off
        $.stop_from_timeline = off
        $.startframe = 269
        $.stopframe = 539
        A_StartSim sim
        A_Wait sim
        $.startframe = 570
        $.stopframe = 659
        A_StartSim sim
        A_Wait sim
        $.startframe = 690
        $.stopframe = 780
        A_StartSim sim
        A_Wait sim
        $.startframe = 1260
        $.stopframe = 1349
        A_StartSim sim
        A_Wait sim



        Click image for larger version

Name:	bb2.jpg
Views:	289
Size:	41.8 KB
ID:	1118733Click image for larger version

Name:	bb3.jpg
Views:	284
Size:	41.4 KB
ID:	1118734
        Attached Files
        i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

        Comment


        • #5
          The script looks good and seems to be working just fine here. Does it happen if you run the script again?
          Can you send over a Phoenix log? It's located in C:\ChaosPhoenix
          Georgi Zhekov
          Phoenix Product Manager
          Chaos

          Comment


          • #6
            I just tried running it again with the GUI and backburner, same problem thing with both.

            Where can I send the file to ?

            Thanks !
            i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

            Comment


            • #7
              Just attach it here as a zip file
              Georgi Zhekov
              Phoenix Product Manager
              Chaos

              Comment


              • #8
                Hehe ok

                This time I was using this range:

                sim = getnodebyname "PhoenixFDFire001"
                select sim
                $.start_from_timeline = off
                $.stop_from_timeline = off
                $.startframe = 570
                $.stopframe = 659
                A_StartSim sim
                A_Wait sim
                $.startframe = 690
                $.stopframe = 780
                A_StartSim sim
                A_Wait sim
                $.startframe = 1260
                $.stopframe = 1349
                A_StartSim sim
                A_Wait sim


                it gets stuck on the second range of frames on frame 690

                ChaosPhoenix 3ds Max 2022.zip


                i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

                Comment


                • #9
                  Okay, nothing very suspicious in the log at first sight.

                  How do you run the script by the way? Are you using some callback so that it runs in backburner?

                  What I do is to just run it in the MaxScript listener so may be that's what's different.

                  Does the issue reproduces if you make a new scene with just an empty simulator and then you run the script?

                  Thanks!
                  Georgi Zhekov
                  Phoenix Product Manager
                  Chaos

                  Comment


                  • #10
                    To run the script I just check "Use Script" and add the script in the window that pops up which has the sample script from Chaos, then I close it and start the simulation.

                    To run it in backburner I use the menu option Submit Simulation to Backburner with the options in the screenshot, so far it's working the same way as without backburner and yesterday I purchased a permanent simulation node so I can do this on another machine but this has to be solved first so I can actually automate something lol.

                    by the way, after purchasing the simulation node I'm supposed to install Phoenix on the node machine correct? I did install it on the node machine.

                    I could not find instructions on what to do, I was having problems starting the simulation on the machine and it was probably a problem with me specifying a path properly but I was unsure if I was supposed to install Phoenix on the node or there was another type of installation procedure for the simulation node




                    I'll try with a new scene

                    Click image for larger version

Name:	1bb4.jpg
Views:	258
Size:	55.9 KB
ID:	1118744
                    i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

                    Comment


                    • #11
                      Originally posted by georgi.zhekov View Post
                      Okay, nothing very suspicious in the log at first sight.

                      How do you run the script by the way? Are you using some callback so that it runs in backburner?

                      What I do is to just run it in the MaxScript listener so may be that's what's different.

                      Does the issue reproduces if you make a new scene with just an empty simulator and then you run the script?

                      Thanks!



                      When I run it from the listener it works perfectly but when I check the "Use Script" option and paste the script in the script window and start the simulation it goes into some kind of crazy loop on the first frame of the second range of frames.

                      All this on a new scene and an empty container.

                      This will work for now but I'm wondering how I will start the simulations and the ranges I want to simulate through backburner.

                      Click image for larger version

Name:	bb5.jpg
Views:	241
Size:	389.8 KB
ID:	1118762

                      Thank you Georgi


                      Attached Files
                      i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

                      Comment


                      • #12
                        Hey,

                        The purpose of the script under the Simulation rollout is very different - it allows you to execute something specific at certain moments of the simulation, like on each simulated frame, on simulation end, etc.

                        If you want your submission to backburner to start a sim, stop it, start it again and so on several times, you need to edit Phoenix's menu code for the Submit to backburner command. This all gets very complex and this is the first time anyone asked about such a thing, ever, so I highly suspect we are going the wrong way.

                        Please allow me to rewind everything back to the beginning: Why do you need to start the sim, then stop it, then start it again later? If you do that, the sim is going to just forget what it did during the earlier timeline frames and will start simulating all over again with the state of the scene at the later timeline frame, so it's a bit strange. This sounds to me more like a work for several separate simulators. These you can send to backburner without any maxscript magic. You only have to watch out and exclude them from interacting with one another from the Scene Interaction rollout, if they overlap. Or even better, switch the interaction type to Include list and pick all the sources, forces, emitters and obstacles that should be present in the simulation and leave all other simulators or other nodes out of the list.

                        Cheers!
                        Svetlin Nikolov, Ex Lead Phoenix developer

                        Comment


                        • #13
                          Hi Svetlin,

                          Yeah, no wonder why this script option was behaving like that

                          The animation is something like steam coming out from drains, it's not a constant thing, in the animation you can see it start coming out and then stop and dissipate, that's why I need it to start and stop instead of just keep going for 1900 frames which I would do if that was the case.

                          At first I thought of creating several simulators to avoid having to post a question but the simulator is doing the exact same thing whether form camera A or B on whichever frame range and any camera angle so I thought there was a way to assign frame ranges.

                          I thought that if my simulation was on the camera frame let's say 10 different times I would have to create the same simulator over and over ten different times so that's why I wanted to be able to start the simulator many times at different ranges

                          Using the listener to start and stop the simulator totally works but how to send the task in that way through backburner is my question now, since it's a machine on the network I can just change the frame range manually and let it simulate then change it again and it won't be as bad as having my workstation dealing with this stop and go


                          Thank you !
                          i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

                          Comment


                          • #14
                            Ahhh, yes, tens of simulators is too much.

                            If the smoke is doing the same thing, then another approach could be to simulate it once and then loop it for the Input rollout's Loop mode, or if the smoke comes out at irregular intervals, then switch to Cache Index mode and animate the Direct Cache Index. Would this work?

                            Indeed the simulator is not intended for starting and stopping so we honestly never designed it for this, so now this puts it in 'workaround' mode

                            Cheers!
                            Svetlin Nikolov, Ex Lead Phoenix developer

                            Comment


                            • #15
                              Originally posted by Svetlin.Nikolov View Post
                              Ahhh, yes, tens of simulators is too much.

                              If the smoke is doing the same thing, then another approach could be to simulate it once and then loop it for the Input rollout's Loop mode, or if the smoke comes out at irregular intervals, then switch to Cache Index mode and animate the Direct Cache Index. Would this work?

                              Indeed the simulator is not intended for starting and stopping so we honestly never designed it for this, so now this puts it in 'workaround' mode

                              Cheers!

                              Thanks for the tips Svetlin, you guys are awesome.


                              i9 - 1980XE 256 GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x EVGA RTX 3090 XC3 NVLink, i9 - 1920X 64GB - 2x RTX 2080 Ti NVLink

                              Comment

                              Working...
                              X