Maxwell Render

Maxwell Render Information Repository
It is currently Fri May 24, 2013 7:19 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Tue May 10, 2011 10:10 pm 

Joined: Sat Jan 09, 2010 12:42 am
Posts: 50
Location: London, UK
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


Top
 Profile  
 
PostPosted: Tue May 10, 2011 10:36 pm 
User avatar

Joined: Wed Dec 15, 2010 11:44 am
Posts: 195
Location: Brighton, UK
Sounds intriguing, I'd be interested in a technique like this as well, as many of my animations are simple orbits.

_________________
My Maxwell Render Tutorials

University of Brighton, UK
http://www.coroflot.com/James_Coleman
@JColeman_Design


Top
 Profile  
 
PostPosted: Wed May 11, 2011 12:13 am 
User avatar

Joined: Wed Nov 16, 2005 3:02 am
Posts: 7585
Location: desk #861
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:
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:
// 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!!");
}

_________________
Next Limit Team


Top
 Profile  
 
PostPosted: Wed May 11, 2011 12:44 am 

Joined: Sat Jan 09, 2010 12:42 am
Posts: 50
Location: London, UK
Very grateful for your help JD

Just in time for my batch rendering to start by the end of the week.
Can't way to run it through.

El


Top
 Profile  
 
PostPosted: Wed May 11, 2011 4:35 pm 

Joined: Thu Nov 13, 2008 2:52 am
Posts: 977
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


Top
 Profile  
 
PostPosted: Wed May 11, 2011 5:40 pm 
User avatar

Joined: Wed Nov 16, 2005 3:02 am
Posts: 7585
Location: desk #861
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.

_________________
Next Limit Team


Top
 Profile  
 
PostPosted: Sat Dec 31, 2011 1:32 am 

Joined: Thu Nov 13, 2008 2:52 am
Posts: 977
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:
var baseName = "Scene ";


with

Code:
var baseName = "";


is that the thing to do or can I remove that line altogether?

-Brodie


Top
 Profile  
 
PostPosted: Sat Dec 31, 2011 4:24 am 
User avatar

Joined: Wed Nov 16, 2005 3:02 am
Posts: 7585
Location: desk #861
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:
Scene.setActiveCameraName(sceneName);
...
if (Scene.activeCameraName != sceneName)

Like this:

Code:
Mxi.setActiveCameraName(sceneName);
...
if (Mxi.activeCameraName != sceneName)


Quote:
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.

Quote:
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.

_________________
Next Limit Team


Top
 Profile  
 
PostPosted: Tue Jan 03, 2012 7:26 pm 

Joined: Thu Nov 13, 2008 2:52 am
Posts: 977
That seems to be working. Thanks JD

-Brodie


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group