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:

MakeFrustum: a Nuke-Style Frustum Preview for Maya

Update: If you tried the script and it failed, grab it again because the previous one had a call to a “MergeVerts” function which is just a personal alias to MergeToCenter.

So, after years of having a hard time finding cameras and knowing where they are pointing, I decided to make a script that would give Maya a Nuke-style 3D camera frustum preview that is parented to the camera. It will accurately reflect what is shown in the camera according to it’s FOV/viewing angle. I’m pretty pleased with the result and I had to dig up some old trigonometry that I haven’t done in ages to calculate the face side lengths. Most of my other scripts are just tasks and variables, so to all you proper engineers – fear my grade 7 math!:

Anyway, grab the script here and run “makeFrustum;”, select a camera and go nuts. The only caveats are that it doesn’t work with vertical fitting, only the default horizontal. If you want to delete the frustum, it’s just under the object in the Outliner:

It’s templated, so that’s why it’s orange and it won’t show up in renders. In the future, I may look into making it update live but that would likely involve API stuff and Python.

0 notes | Permalink

Automator Workflow to Migrate Maya ASCII/Nuke/plaintext Files to Another Disk

I am just moving my work to a new Lacie 2big Thunderbolt enclosure and wanted to save myself annoying task of migrating all my existing work to link to the new disk in place of my old one. There are nice utilities like FileTextureManager for Maya and Nuke has a find/replace that do this on a per-scene basis but this seemed slow since I would be doing the exact same replacement for all future files.

So I made an Automator workflow that reads plain text files and substitutes my “dullard/WORK_mbp” path in the file with “lackey/WORK” and then creates a new file next to the old one so nothing is clobbered. Since Maya ASCII and Nuke files are plain text, the script can use the Unix utils awk and sed as if it were just working on a big (and quite boring) essay.

See it in action:

Grab the Automator workflow here. Obviously, you’ll need to edit the workflow in Automator to substitute your paths instead of mine:

The text between the % are the find and replace terms. The script doesn’t overwrite any files but just for the sake of legalese, it comes with no guarantees.

0 notes | Permalink

Amazing Python Script for Nuke That Creates a 3D Camera from a V-Ray EXR Image

If you do compositing in Nuke, you know it can be annoying to get camera data in and out of a 3D package like Maya or Max. Imported camera data quickly gets outdated when new frames are rendered, which forces you to jump back and forth between your 3D app and Nuke. Fortunately, yesterday I discovered a script for Nuke that makes it dead simple to generate camera data from the camera metadata embedded in V-Ray’s EXR-rendered images. After installing the Python script as a menu item, just select a V-Ray EXR render and the script will make a camera node that you can plug into a 3D scene template. It’s amazing:

It even works with animations, meaning you never have to jump back to your 3D app to get new camera data – just kick out a new camera node for the newer EXR frames.

So, here is how you install it. Grab the Python code from the Pastebin site here. Paste it to a new plain text file in your Nuke scripts folder. In OS X and Linux, that’s ~/.nuke/ (where ~/ is your home folder). OS X users can make short work of it by doing this in the terminal after copying the code:

pbpaste > ~/.nuke/createExrCamVray.py

pbpaste is a command line version of a pasteboard paste command in OS X (pbcopy does a copy if you want to pipe to the clipboard). Next, add the call to the script to your Nuke menu bar by adding these lines to the end of Nuke’s menu.py file (For me, it’s located in /Applications/Nuke6.3v4/Nuke6.3v4.app/Contents/MacOS/plugins/menu.py):

import createExrCamVray
m = menubar.addMenu("V-Ray")
m.addCommand("Create Camera from EXR", "createExrCamVray.createExrCamVray()")

The code is wrapping on my blog site, so it’s better to grab it from this text file. Then, once you relaunch Nuke, you’ll be set up.

6 notes | Permalink

My MakeHuman V-Ray SSS Skin Conversion Templates

So, after some tweaks and playing around, I’ve come up with a good starting set of templates to convert MakeHuman output characters to V-Ray for Maya via Nuke. Download the setup files at the bottom of this page (includes Maya V-Ray scene and source images as well). Currently, the Nuke template that I use for the source skin is set up for the caucasian skin PNG files that come with MakeHuman. I tried using it for the Indian-looking skin and it is far too red, but I’m sure someone could quickly get it working with different skin types. That is the advantage to this procedural Nuke template: it requires little work to make variations, unlike a series of Photoshop edits, which would be tricky to do for things like cloning and brushing of the lips. I realize not every uses Nuke for image edits but it’s great for stuff like this and I’m just making my work available to you. So, this is how it works: you take your single input PNG file and plug it into the starting point file input of the Nuke template (click for high res):

The Nuke script then splits up the single RGB input and does the appropriate edits and output for all elements of a V-Ray FastSSS2 map. How good is it? Well, I’m not an expert on skin and SSS but it’s a good start, in my opinion. The source MakeHuman PNG:

The Nuke template has two options for types of image input. If you’ve edited the texture in Mudbox or Mari and used 32-bit mode for the textures, use the linear gamma file input.

Here’s a render in Maya of the caucasian female skin PNG conversion:

It’s using a V-Ray Fresnel Blend Mat setup, so if you want to use it as a template for other work, go ahead. It’s free for use in commercial work. It could still use some tweaks for the lips and the only real problem with this setup is that the bump map can’t be used because of the texture map seams, so it looks a little too uniform. That’s also a fault of the actual texture, which doesn’t have any vein touches or pores – this isn’t meant to be feature actor material, just background figure quality. I left the bump stuff in the template files since I thought you might find it useful to see how it’s done and if you want to make a seamless fix for yourself. The Nuke scene includes a 3D reference model so you can check for seams in a 3D viewport while working on the textures. I’ll work on it eventually and post the revised work here. This is very much a work in progress and this is the 1.0 release of this package.

Download: MakeHuman Maya and Nuke template files v1.0

Just a note that the model is nude, since I was checking for seams. You might not want to freak out your guests by opening an unclothed tween on your screen.

2 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

Interactive Command Line Nuke script

I made a simple shell script to use for interactively prompting start and end frames:

Same logic as the Maya one here. Here’s the download link:


Just set up your $PATH variable for Nuke or put an absolute path to the Nuke binary in your script. Works in OS X and Linux.

0 notes | Permalink

Denoise Filtering a GI Pass - I Feel Dirty but it Works

Last week, I had a limited time to render out 3600 frames of 1080p animation – and couldn’t use any light caching because of the moving lights and models. Even with a hyperthreaded 12-core Xeon Mac Pro and Sandy Bridge MacBook Pro as a slave, time was just too tight to meet the deadline, so I turned to a number of time-saving tricks to get the best balance of quality and low noise. I used a Viewport 2 playblast with baked ambient occlusion for my ambient occlusion pass:

That’s actually a mixed of a ZBrush cavity map and ambient occlusion.

But the real time-saving and quality came from Nuke X’s Denoise filter, which helped lower the per-frame render time while keeping noise down. Because I come from a print background and have art directed magazines that dealt with a lot of film footage stills as publicity images, I have a lot of experience with denoise filters like Noise Ninja and Neat Image. They are amazing at preserving detail while reducing chromatic and luminance noise and they’re far more mature than the noise filtering algorithms offered in renderers. So, with V-Ray set to Time Dependent to jitter the noise, V-Ray Nederhorst settings and a threshold setting that would otherwise be too low for production quality, I set up my render passes with this awesome Maya Python script…:

…and I filter the Raw GI pass to lower the noise:

You’ll need to watch that on a 1080p-capable screen to see the results clearly.

I may not be proud but I am pleased. If you are using Nuke without the Denoise filter or After Effects, give Neat Video a try. It’s the animation version of my favourite still image denoise filter and they have a demo for all platforms.

1 note | Permalink

Coming in V-Ray Tuner 2.2: Exposure Round-Tripping for Fast Lighting Tweaks

Some of you have probably seen me using the per-light rendering features of V-Ray Tuner, since it gives me a lot of control over a complex light setup without having to re-render, similar to Maxwell Render’s multilight feature. But, seeing it in action, you probably also thought to yourself “that seems slow and impractical for animation.” Well, I’ve finally implemented something I’ve been meaning to do to enable you to roll your exposure settings back into Maya from Nuke tweaks so that you can do a draft per-light rendering, hone your light balance and then take those exposure settings from Nuke or Photoshop and then input them to change each light’s value in Maya. Then you render a single final image that has perfect lighting. If you work on product shot type things, this workflow will save a ton of time in the long run:

In Nuke, you set the Exposure values to Stops to emulate F-stops, then adjust your exposure to make the lighting exactly as you want it and then, once you have a balance of lighting that you like, go back to Maya, select your V-Ray light and then run the Per-Light Render Exposure Tweak script from the Utilities menu and enter each exposure value into the field with the respective light selected.

As I mentioned above, it also works in Photoshop. Pick your per-light images in the File/Scripts/Load Images Into Stack dialog and they will all load into a layered document:

Set each layer to Linear Dodge (Add) and add a clipped Exposure adjustment to each (by alt clicking between the layer and the Exposure adjustment):

And the workflow is much the same as in Nuke:

That has the exact same exposure settings as the Nuke exposure and looks just like our final flat render. The cool thing about the Photoshop method is that you can flatten your Exposure tweaks into each layer and do another round of exposure edits without having to render out more per-light passes. Obviously, you need to use 32-bit renders for this to work effectively since 8- and 16-bit ones aren’t floating point and degrade with exposure edits.

I just need to update it to work with meshes and V-Ray Light Materials. Thanks go out to Will Earl who helped explain the math of the exposure conversion to me.

3 notes | Permalink

Using Nuke with Mudbox for V-Ray SSS Skin Conversion

I’ve been doing a lot of skin stuff lately and getting into the proper SSS workflows for V-Ray. While many people have different settings they prefer for a different type of look, some favouring ultra-realism, where I set mine to be slightly on the illustrated side, the workflow is the same between those two looks: you make a V-Ray blend mat with a V-Ray SSS2 base material with its reflectance set to black (none) and use a coat V-Ray Material with black diffuse (contributing nothing) but a mapped, glossy reflectivity for the shine. That is blended by a Fresnel material, which is extremely important – it handles all of your reflectance and gives your skin the healthy Palmolive shine that nosy witch Madge always carries on about. This shader softens your hands while your girlfriend asks you to do the dishes:

Here’s the general layout of the V-Ray Blend Mat shader network:

and a snapshot of what those three input textures within the V-Ray SSS2 material:

You can see which they drive in the title bar name of the image.

Since this workflow has you create at least four materials (diffuse, SSS, overall and specularity), one of the things I learned to do early was to use Nuke to convert my single Mudbox-painted skin texture to these four output textures that have completely different balance and contrast. Since most of my skins are pretty similar and I often revise things mid-project, this non-destructive workflow is a staple of all my skin pics (nyuk). Here’s a peek at the Nuke scene that I use as a template:

At the left is the flattened Mudbox texture and the right half is the SSS material generated from the adjustments to the Mudbox diffuse texture. The initial rotopaint is a dodge to lower contrast since any contrast with SSS textures will show up a lot. The second rotopaint at the right is a painting in of increased finger nail reflectance. All our textures done in one shot. Not bad.

3 notes | Permalink