Dave Girard's 101 Autodesk® Maya® Tips is now available in Kindle, interactive iPad edition and DRM-free EPUB/PDF editions. Work faster, cry less. Read more about the ebook.




Follow cgbeige on Twitter

Topics by tag:



Recently published articles by Dave G:



Free downloads by Dave G:



Mac OS X-only downloads:

A Guide to Creating a V-Ray Linux Render Slave

Recently, I’ve fielded a lot of questions about setting up a Linux-based V-Ray render box and most of those queries are coming from Mac users who are in need of more oomph but don’t want to shell out for the very dated 2010 Mac Pros. So slavery is all the rage as people are discovering the merits of cheap additional labour. But Linux is the black diamond course of computing, so here is a quick rundown of what’s involved in getting a Linux slave machine up and running with a V-Ray render service.

CentOS, Chained
For my headless Linux workstations, I use CentOS 6.3 (later is fine and may be required by your newer hardware) because it is the easiest to get running with Maya. If you’re unfamiliar with Linux, you want to avoid missing dependencies that have to be installed later, and CentOS runs Maya fresh from the install. Fedora should be avoided unless you know what you’re getting into. Ubuntu is not an option because it’s a Debian-based distro and Maya (like most CG apps) require a Redhat-based distro to function. You can do a bunch of hacks to make it work but it’s just not worth it for a headless slave machine. Ubuntu is all about usability and you won’t be using this machine beyond it’s functions of sleep, wake and render. Hence it’s not-so-glorious title of slave.

Installation
So here are the instructions to get CentOS up and running. Install CentOS with the Software Development install option to ensure you have all the necessary libraries installed. It might work with others but this is a good, safe bet. During the install process, enable the network because CentOS disables it by default. If you miss this, you can do it on boot (it’s an icon in top right the GNOME menu bar).

Maya and V-Ray Installation
Install Maya with your serial number – there is no demo option on Linux. You have to use the terminal to run the Maya installation. Open it and cd to the uncompressed Maya installation folder and then type “su” to switch to the root user. Then type “./setup” (all this is without the quotes) – if you just enter the full path to the setup file without cd’ing first, it won’t be able to find anything for the install. That stumped me for a while when I first installed Maya on Linux. Once it’s done installing, don’t run Maya because you’ll be asked to activate it. You don’t need an activated Maya install for use as a slave so skip running the application itself and move on to V-Ray installation.

V-Ray Slave Service Installation
Before you install any old V-Ray version, make sure you get a build of V-Ray 2.4 or later, that does automatic asset transferral so you don’t have to concern yourself with setting up finicky, matched-absolute path network sharing. Currently (2013-04-18), that’s only available in nightly builds so contact Chaos Group to get access to nightlies and you have a non-EDU license. During command-line installation, make sure you register it as a slave service. The slave service won’t start unless you reboot or launch it manually for the first launch. If ever you try and launch it and it fails, that means it’s already running. To ensure that the slave is seen and accessible from other machines, open the V-Ray service TCP port in the CentOS firewall settings. With 3.4 betas, the port is currently 30304.

Some things to keep in mind:
To get sudo access to do stuff like “sudo pm-suspend” to sleep the machine from the command line, you’ll need to use visudo to add your user to the sudoers list. Google that – visudo is just vim and it uses a weird list of key combinations to use it. Otherwise, just su to root and issue the command without sudo.

You’ll probably want to edit your router to reserve an IP for your machine so it doesn’t change. To get the IP and MAC address of the machine, type “ifconfig -a” in the terminal. eth0 is the ethernet connection (or eth1 if you have more than one). That will also give you the MAC network address for use with WOL (Wake on LAN). With a static local IP, you can reliably wake the machine from sleep with a utility like WakeOnMac (OS X) or Wake Me On LAN (Windows). You may need to enable WOL in your machine’s BIOS settings. You don’t have to enable it in CentOS and it’s not dumb like WOL in Windows machines that seem to wake just by looking at them.

Additional Linux and command line tips for newbs
I wrote a guide to getting command line rendering up and running for Maya users on OS X that will probably be helpful to understand Linux as well, since both use the BASH shell by default.

If you’re looking to actually run this machine as a Maya workstation, then you have more work ahead of you, as you get to do all the mind-numbing work of blacklisting nouveau (Google it) to install Nvidia’s drivers and stuff like that. Still, it’s easier and more stable than making a Hackintosh. Luke Olson’s Linux for CG and VFX Production Environments is a really good primer if you want to use Linux with CG apps. He mostly uses Houdini, which installs on Ubuntu without issue, so keep that in mind if you’re wondering why he’s recommending it alongside Fedora. I would steer clear of it personally. Do your worst, Ubuntu zealots!

1 note | Permalink

Maya File Preview Batch Processor for OS X

In an older post and in my 101 Autodesk Maya Tips, I talked about how you can send UNIX standard output to Maya via its commandPort and I just made a tool that batch generates previews for files using an open session of Maya. I made something similar in the past but it was slow because it launched a new session of Maya for each file via command line rendering. This is very quick because it just tells an already-open app to make a new scene, import the file, kick out an antialiased viewport 2 render to JPEG, wash, rinse and repeat.

Here is the Automator workflow file to install. Don’t rename it because it contains a shell script (stmaya) that bounces commands to Maya. You need to enable commandPort on port 2222 before Maya will accept input from the action. Do it with this command (I put this line in userSetup.mel so it is executed on Maya’s launch):

commandPort -n ":2222";

The only thing to keep in mind is that the script sets the imported file folder to your working project directory, so just remember to change it to your desired project after you’re done batching or you’ll be rendering into the last-previewed /tmp folder. Also, save your existing open work before you start doing these because it uses the “file -f -new” command meaning it won’t prompt you to save if you have an open doc with unsaved changes.

If you’re on Linux, you can do a similar thing with the two shell scripts that the Automator action uses. This is the script that operates on your input 3D file and this is the stmaya script that passes standard output to Maya. It’s a bit of a hairy combo that would be much nicer as one Python script but I am just updating existing bash scripts.

Sorry, Windows users – there’s no way to pipe standard output to Maya from the command prompt in Windows, so this can’t be adapted for non-UNIX OSes.

0 notes | Permalink

Maya Crash File Opener Updated for OS X

When Maya crashes, it tries to save out a file to a temp folder that you can recover on relaunch. In my 101 Autodesk Maya Tips I mention how you can get this file to open in Maya without digging through temp folders on Mac/Win/Linux but it seems that, due to what I think is V-Ray’s redirection of standard output, I no longer get the path of the crash file in the system log. So, I’m updating the script to work more like the Linux version. It does the exact same thing but by parsing the TMPDIR environment variable:

Grab the updated shell script or Automator Service which doesn’t require a terminal. Just open it from the Services menu in OS X.. After Maya 2014 is out, I’ll be releasing an updated version of 101 Autodesk Maya Tips to incorporate this change and I’ll add some new tips as well. Existing owners should receive the updated copy for free.

1 note | Permalink

Easily Strip Out Plug-in Info from Maya Scenes

If you have a lot of plug-ins installed, you know that they can make it a pain to hand off files to other people. Since I generally sell components of my 3D illustration as stock after I complete them, it’s important to make clean assets for sale. While you can manually strip out plug-in data from Maya ASCII files, this is time consuming and there’s a much easier way to do it. Keep a copy of Maya around that has no plug-ins installed or at least no copy of the plug-in you want to strip out installed. When you open a Maya ASCII scene in that copy of Maya, it will fail to recognize nodes and data that call that plug-in so using the Optimize Scene Size dialog with “Remove Unused Nodes” will strip out those parts, leaving a cleaned file on save.

If you’re using Maya 2013 and above, you also have to worry about the new “-ch ####” data that breaks backwards compatibility, so I’m using my Automator action that strips out that data with sed and saves a “_2012_compatible” (and earlier) version. With those two techniques in mind, watch me clean all the Maxwell plug-in info from a Maya 2013 file and open it flawlessly in Maya 2010:

V-Ray is loading because it’s auto-loaded at startup.

If you’ve read my 101 Autodesk Maya Tips ebook, you might have figured out how to do this from my tip on using Optimize Scene Size and Maya ASCII scenes instead of Maya binary. /end shameless plug.

3 notes | Permalink

Nuke Scene Collector 2.1 

I just posted an updated version of Nuke Scene Collector that now supports collection of scripts that use the project directory variable to reference assets:

3 notes | Permalink

Nuke Scene Collector 2.0 Now Live

My Mac OS X/Linux shell script for collecting and transferring Nuke scenes and assets has been updated to version 2.0. Nuke Scene Collector 2.0 adds #### style number sequence support for Read nodes and the %04d style ones still work – you can mix them in your Nuke script without it tripping up collection. Otherwise, what gives it the 2.0 version bump is the increase bullet-proofing to the collection process. Since it was using the UNIX cp utility for copies, it could crap out if your file list was really long (like thousands of entries), so it now uses the find command and executes the copy on each entry instead of on the batch. If you care about the difference, here is how that looks. The old code for copying all EXR images with wildcard for sequences:

cp /path/to/filesequence.[0-9]*.exr /destination/

The new copy code using find and an -exec cp argument for the copy portion:

find /path/to/ -name "filesequence.[0-9]*.exr" -exec cp -i {} /destination/ \;

You can use that “find … -exec” pattern on anything really. If you want to lame encode a bunch of files in the working directory to mp3, it’s pretty much the same:

find . -name "*" -exec lame --preset extreme {} \;

Some of you are probably thinking “why not just use Python and then you could avoid this and you’d get Windows compatibility? Ya, if I was to rewrite this utility, I’d just use Python but I’m not a pipeline TD, I’m just posting stuff I use for myself so that’s not going to happen. Windows users looking for something similar can check out this. I don’t know how well it works since I’ve never used it but it seems to be fine.

0 notes | Permalink

Tip for Linux V-Ray Tuner users: Use the Sleep After Render Features

V-Ray Tuner has a “sleep at end of render” script that works on all three platforms but I realized recently that most Linux distros require that you run pm-suspend as root, nullifying the script. This can be addressed by letting users run pm-suspend without sudo. Just use visudo to add these lines to your user’s sudo permissions to prevent a prompt for password when using sudo:

username ALL=NOPASSWD: /usr/sbin/pm-suspend

Until I post an update, Linux V-Ray Tuner users will have to find and replace “pm-suspend” with “sudo pm-suspend” in the V-Ray Tuner MEL script.

0 notes | Permalink

Easy Fix to Make Maya 2013 Scenes Compatibile with Older Maya Versions

I mentioned a while ago that Maya 2013 breaks compatibility with older versions since it added some data to the Maya ASCII format that the other versions don’t understand. Well, it seems that this is pretty easily addressed with a simple find and replace in a text editor. The offending flag is “-ch #####”, where the ### is any number of whatever length. To make 2013 scenes compatible with older Maya versions, just replace that flag and the space after it with nothing:

If you have a text editor that supports regular expressions, use a regular expression in the find field and replace all with nothing. This is what that would look like:

Note that there is a space at the end after the “" that you can’t see – In BBEdit, regular expressions are referred to as GREP, the Unix app that finds things by regular expressions. I’m using BBEdit and it’s really good with giant text files like these but I went a step further and made a shell script for OS X and Linux that just does it all in one step with sed and saves out a file at the same location with a “_2012_compatible.ma” extension. Anyway, you can see it all works perfectly in this video:

The shell script can be downloaded here for OS X and here for Linux (tested in CentOS 6.3). OS X and Linux use different versions of the basename util so the syntax is slightly different.

Update: There is now a Python version of the stripper script that works with Windows as well as OS X and Linux. Thanks to Dhruv Govil for that. The Python script can be run from within Maya or from a command line. To run it from a command line, enter “python /path/to/stripper_2013.py /path/to/scene.ma”. Check the script contents on how to run it from within Maya.

I also made an Automator action for OS X that does the same thing:

Grab that here.

If you don’t know what version the document was created with, I made another Automator action that reads Maya ASCII files and tells you what it is with Growl:

Grab that here. It requires the growlnotify command line app be installed in /usr/local/bin/

5 notes | Permalink

Generate Thumbnails for Maya Documents in OS X and Linux

There are some Windows thumbnail apps for Maya docs that get mixed results and cost cash money. I just whipped up something that uses Maya itself to generate a hardware rendered preview for selected .ma or .mb files (it also works on OBJ, FBX, etc):

It’s just a shell script that can be adapted to work in Linux as well as OS X (and Windows if you use Cygwin).

Here’s the shell script (run it by doing path/to/script.sh file1.mb file2.ma file3.obj)

Grab the Automator workflow here.

Both the shell script and Automator actions reference Maya 2012 on OS X. Just change the path to reference your Maya version.

Update: I made a revised version that renders the preview to /tmp and uses QuickLook to preview the document, for less clutter:

Grab it here: QuickLook_Maya.workflow

0 notes | Permalink

Get ‘Em While They’re Hot: 30% Off Promo Code for New cmiVFX Series “Linux for CG”

I’m going to be doing a video series for the venerable cmiVFX and while I can’t tell you about the series’ contents, I can say that they just released a pretty sweet “Linux for CG" series by Luke Olson, who is very knowledgeable in Linux in production. I’ve known Luke from his RealFlow Python scripts and his active presence on CGSociety’s forum – he know’s his stuff. I wish I’d seen this series a couple weeks ago when I installed Linux on the HP Z820 that I’m reviewing for Ars Technica. It would have made my life a lot easier.

cmiVFX was nice enough to give my blog readers a 30% off promo code for the series. Just enter PPP30 when purchasing it. The code’s valid for 60 days from around yesterday, June 10, 2012. Just a note that I don’t get any kickback or anything like that for those sales. Enjoy, especially now that Apple’s not going to be getting a Mac Pro update out until 2013.

0 notes | Permalink