All posts related to V2
#342521
Hi everyone.

I use Maxwell to batch render simple animations with the
camera hovering around without changing much, if anything at all, in the scenery.

Since FIRE can update quickly without having to re-export the scene
or re-Voxelize it every so often as long as the scenery remains unchanged
does that mean there is a trick to force the batch renderer to do the same
instead of taking a long time to re-voxelize every frame?

Would save a lot of time if that were possible.


Regards
El
#342533
Given an MXS which contains several cameras, the below script will render each one in succession without revoxelization. The cameras need to be named in such a way that the script can automatically build the name of each one. So for example, this was written to be used with SketchUp, which follows the naming convention: Scene 1, Scene 2, Scene 3, etc.

You can see near the top of the script the three main variables: firstFrame, lastFrame, and baseName. These are the only variables you will need to customize, and the way of doing so should be somewhat self-explanatory; given an MXS containing cameras named Camera.1, Camera.2, Camera.3, and Camera.4, you would set the script up like this:
Code: Select all
var firstFrame = 1;
var lastFrame = 4;
var baseName = "Camera.";
And here is the script; to use it, paste into the script window in Maxwell Render, then hit the Run Script button (you can also save it to file for later use):
Code: Select all
// This script loops through a set of cameras, specified by name and
// index. It must be customized to fit the characteristics of the given
// MXS file. As set up, it expects to find the MXS filled with cameras
// whose names begin with 'Scene '. This base name is stored below
// in the 'baseName' variable. It expects the scene numbers to begin
// at 1 and to end at 3, with these limits being stored below in the
// 'firstFrame' and 'lastFrame' variables. It will loop through the frame
// range looking for cameras which fit the pattern 'Scene 1', rendering
// each one as it is found.

var firstFrame = 1;
var lastFrame = 3;
var baseName = "Scene ";

// internal vars & events

var isRendering = 0;
var currentFrame = firstFrame;
var outputFolder = FileManager.getFileFolder(Scene.mxsPath);
RenderEvents["renderFinished()"].connect(renderHasFinished);

// render loop

while (currentFrame <= lastFrame)
{
  renderCamera(currentFrame);
  while(1)
  {
    if(isRendering == 0)
    {
        break;
    }
  }
  currentFrame++;
}

// functions

function renderCamera(frameNumber)
{
  var sceneName = baseName + frameNumber;
  Scene.setActiveCamera(sceneName);

  if (Scene.activeCameraName != sceneName)
  {
    Maxwell.print("The MXS contains no camera named '" + sceneName + "'!");
  }
  else
  {
    Maxwell.print("rendering Scene: " + sceneName);
    Scene.setMxiPath(outputFolder +  "\" + sceneName + ".mxi");
    Scene.setImagePath(outputFolder + "\" + sceneName + ".png");    
    isRendering = 1;
    Maxwell.startRender();
  }
}

function renderHasFinished()
{
  isRendering = 0;
  Maxwell.print("Render finished!!");
}
#342548
Wow, nice script JD. This is really intriguing. I guess as the script is written each camera will render to the SL that is set in the MXS before moving on? Is there a way to combine this with the progressive animation script so that you could run each camera to a low SL before progressively moving to a higher SL?

-Brodie
#342550
I'm not sure Brodie, I just threw this script together in the moment, and really haven't looked very much into what's possible via script in Maxwell (fwiw, there's info on it the Maxwell manual). So I don't know how you'd deal with resuming each rendering, if that's what you meant. I am heading off to attend the AIA convention shortly and will be gone through the weekend, but I can take a look after that.
#351155
When I try running this script the Maxwell Script Debugger pops up and gives me this error.

Uncaught exception at <anonymous script, id=0>:42: ReferenceError: setActiveCamera is not defined
42 Scene.setActiveCamera(sceneName);

What am I doing wrong? One thing I noticed is that I don't see a place to input a file path for the MXS. So I loaded the MXS into Maxwell Render and then ran this script. Is that correct?

Also I've tested this out using the Scene 1, Scene 2 convention with the same error. However, my main file just has cameras 1, 2, 3, 4,...1440. If I replace
Code: Select all
var baseName = "Scene ";
with
Code: Select all
var baseName = "";
is that the thing to do or can I remove that line altogether?

-Brodie
#351158
Hi Brodie -- the problem is that the scripting interface has been altered slightly, and that function now exists in a different object. Try changing Scene to Mxi in these lines:
Code: Select all
Scene.setActiveCameraName(sceneName);
...
if (Scene.activeCameraName != sceneName)
Like this:
Code: Select all
Mxi.setActiveCameraName(sceneName);
...
if (Mxi.activeCameraName != sceneName)
One thing I noticed is that I don't see a place to input a file path for the MXS. So I loaded the MXS into Maxwell Render and then ran this script. Is that correct?
Yes, it is meant to be run with an MXS loaded.
is that the thing to do or can I remove that line altogether?
Removing the line would cause the baseName variable to be undefined, so don't do that. It should work correctly with baseName="", though I haven't tested this.
Help with swimming pool water

I think you posted a while back that its best to u[…]

Sketchup 2026 Released

Considering how long a version for Sketchup 2025 t[…]

Greetings, One of my users with Sketchup 2025 (25[…]

Maxwell Rhino 5.2.6.8 plugin with macOS Tahoe 26

Good morning everyone, I’d like to know if t[…]