Quick start to command-line rendering with xsibatch


I like to use a batch file to build my xsibatch command lines.
For example:

set SCN=\\EXAMPLE\Support\Project\Scenes\Scene.scn
set PASSES=Default_Pass,Depth
set XSI_BINDIR=C:\Program Files\Autodesk\Softimage 2011 Subscription Advantage Pack\Application\bin

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%"

Note that I call xsibatch.bat, not xsibatch.exe. That is because xsibatch.bat calls setenv.bat, which sets all the environment variables used by xsi.exe and xsibatch.exe. For example, setenv.bat sets the environment variable that specifies the location of the license server.

This xsibatch command line renders all frames and all passes of the specified scene:

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%"

Note that I need to provide the full path to the scene file, and I enclose it in quotation marks (just in case the path name includes spaces).

-frames allows me to render specific frames. For example, this renders a frameset (frames 1 throught 10):

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%" -frames 1-10

This renders frames 1,3,5,7,…,99 using the syntax -frames start,end,step:

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%" -frames 1,100,2

-pass specifies a comma-separated list of passes to render:

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%" -frames 1-100 -pass "%PASSES%"

-skip tells xsibatch not to re-render frames that have already been rendered (for example, by another render node):

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%" -frames 1-100 -pass "%PASSES%" -skip on

-verbose turns on verbose logging during the render. xsibatch will log the renderer diagnostics (Render Manager > mental ray > Diagnostics)

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%" -frames 1-100 -pass "%PASSES%" -skip on -verbose on

-output_dir allows you to override the output folder specified in the scene file:

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%" -frames 1-10,22 -output_dir %TEMP%

-mb allows you to enable motion blur from the command line:

"%XSI_BINDIR%\xsibatch.bat" -render "%SCN%" -frames 1-10,22 -mb on

If you need to set other mental ray options for a render job, you can use -script with -render. -script allows you to run a script on the scene before it sent to the renderer.

If you run xsibatch -h in a command prompt, you’ll get the usage:
Continue reading

Softimage TEMP folder


While Softimage is running, %TEMP% is adjusted to point to a folder that looks like %TEMP%\XSI_Temp_11676:

LogMessage( XSIUtils.Environment("TEMP") );
// INFO : C:\Users\Stephen\AppData\Local\Temp\XSI_Temp_11676

11676 is the process identifier of the XSI.exe process. To show the process identifier (PID) in the Task Manager, click View > Select Columns and click the PID (Process Identifier) check box.

BTW, Process Explorer is handy for checking out the environment (and other properties) of running processes:

Running EXEs from JScript in XSI


To run programs from JScript, you can use XSIUtils.LaunchProcess.

Here’s a simple example that does a dir on C:\Program Files, redirects the output to a text file, and then uses Notepad to open the text file:

var sPath = XSIUtils.Environment("TEMP");
XSIUtils.LaunchProcess( 'cmd /C "dir > ' + sPath + '\\dir222.txt"', false, "C:\\Program Files" );
XSIUtils.LaunchProcess( 'notepad ' + sPath + '\\dir222.txt', false, "C:\\" );

The third argument to LaunchProcess will be the current working directory of the launched process. So in the above example, I’m doing a dir of C:\Program Files (because cmd opens with C:\Program Files as its current directory).

If the exe is not in the system PATH, then you need to specify the full location:

var sCommandLine = "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Common7\\IDE\\devenv.exe";
var sStartupDirectory = Application.InstallationPath( siWorkgroupPath );
XSIUtils.LaunchProcess( sCommandLine, false, sStartupDirectory );

In the above example, I’m using my workgroup location as the current directory, so when I do File > Open in Visual Studio, by default I will be looking in my workgroup location.

Standalone licenses, trusted storage, and the boot sector


Following up on my post the other day about resetting standalone licenses, here’s some more technical information I on dug up on standalone licenses. I did get some conflicting info from people, particularly about the boot sector.

One person told me that all standalone licenses were written to the boot sector, but a lot of the technical documentation I found said just that trial licenses went on the boot sector.

  • Standalone licenses are encrypted and stored in trusted storage. Trial licenses are standalone licenses that are located on the boot sector (track 0 of the hard drive).
  • Trusted Storage is an encrypted file created by FLEXnet when an application standalone license is activated or a trial license is created for the first time. By default, the trusted storage file is created in the following folder and will have a name similar to adskflex_00691b00_tsf.data.
  • Deleting the _tsf.data file file force system to re-create the trusted storage file.
  • The trial anchors can be removed from trusted storage by deleting the trusted storage file itself. The trial anchors can only be removed from the machine by reformatting the drive.

The case of the slow 2011 startup on Fedora 14


In a recent case, a customer reported that Softimage 2011 took forever (four to five minutes) to start on Fedora 14. Softimage 2010 SP1, on the other hand, started up just fine.

It turns out that for Softimage 2011, 2011SP1, and 2011SAP on Fedora 14, you need to put back our x11 patch (this patch was needed for Fedora 8, 9, and 10; Fedora 11, 12, and 13 run with a different compiled version of XCB and don’t need the patch).

Edit the .mwenv file ($XSI_HOME/Application/mainwin/mw/scripts/.mwenv) and change this

if ( "fc8" == "$fcver" || "fc9" == "$fcver" || "fc10" == "$fcver" ) set x11patch="$MWHOME/lib-${MWCONFIG_NAME}_optimized/X11"

to this:

if ( "fc8" == "$fcver" || "fc9" == "$fcver" || "fc10" == "$fcver" || "fc14" == "$fcver" ) set x11patch="$MWHOME/lib-${MWCONFIG_NAME}_optimized/X11"

Then source the .xsi and restart Softimage.

About the x11 patch:

In a previous version of Softimage, we introduced a libX11 workaround because of a problem introduced in FC8 with XCB that can cause freezes during Multi-threaded user interaction. What we did was to place a libX11 binary (compiled _without_ xcb) into a patch directory and then add that directory to the LD_LIBRARY_PATH.

The XCB problem was fixed in FC11, so we modified Softimage. The libX11 binary is still installed with the Linux setup, but the .mwenv script checks the Fedora version you are running and only adds the libX11 patch path to the LD_LIBRARY_PATH for Fedora 8, 9, and 10. So on Fedora 11, 12, and 13 Softimage uses the system installed libX11.

UPDATE: Another symptom of this problem is “EAGAIN (Resource temporarily unavailable)” errors for the tmp/.X11-unix/X0 socket. You’ll see these in the strace log:

socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC, 0) = 19
connect(19, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0"}, 20) = 0
getpeername(19, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0"}, [20]) = 0
uname({sys="Linux", node="homer", ...}) = 0
access("/var/run/gdm/auth-for-xxx-Q2I4go/database", R_OK) = 0
open("/var/run/gdm/auth-for-xxx-Q2I4go/database", O_RDONLY) = 20
fstat(20, {st_mode=S_IFREG|0600, st_size=50, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3360deb000
read(20, "\1\0\0\5homer\0\0010\0\22MIT-MAGIC-COOKIE-1"..., 4096) = 50
close(20)                               = 0     
munmap(0x7f3360deb000, 4096)            = 0
getsockname(19, {sa_family=AF_FILE, NULL}, [2]) = 0
fcntl(19, F_GETFL)                      = 0x2 (flags O_RDWR)
fcntl(19, F_SETFL, O_RDWR|O_NONBLOCK)   = 0
fcntl(19, F_SETFD, FD_CLOEXEC)          = 0
poll([{fd=19, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=19, revents=POLLOUT}])
writev(19, [{"l\0\v\0\0\0\22\0\20\0\0\0", 12}, {"", 0}, {"MIT-MAGIC-COOKIE-1", 18}, {"\0\0", 2}, {"\367\371\200\336\321\\\37\4\22\0324\274\3356|\313", 16}, {"", 0}], 6) = 48
read(19, 0x27ae690, 8)                  = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=19, events=POLLIN}], 1, -1)   = 1 ([{fd=19, revents=POLLIN}])

Setting XSI_USERROOT in a network deployment


I found a way to create a deployment that will override the default XSI_USERROOT. The trick is to add a set_spmhost.bat file to the deployment image.

The Softimage setenv.bat file is already set up to call set_spmhost.bat:

rem SPM_HOST
if EXIST "%XSI_BINDIR%\set_spmhost.bat" call "%XSI_BINDIR%\set_spmhost.bat"

so you just need to put something like this in a set_spmhost.bat file:

rem set_spmhost.bat
rem Override XSI_USERHOME from setenv.bat
set XSI_USERHOME=%XSI_USERROOT%\Autodesk\SI_2011_SAP

set_spmhost.bat is unused in Softimage 2011 and later.
It was used back in 7.5 for Linux customers who also wanted to run on Windows (back then, Linux licenses were still SPM).

In the next release, we’ve set up setenv.bat to call a SiteDeploy.bat file:

rem Verify the existence of the SiteDeploy.bat file
if exist "%XSI_BINDIR%\SiteDeploy.bat" call "%XSI_BINDIR%\SiteDeploy.bat"