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:

Rename Selected Maya File Nodes With Disk File Name MEL Script

I’m going to be adding to the next version of V-Ray Tuner but I thought I’d post this script for people who might want it for other renderers. It’s a script to rename selected File nodes according to their name on the disk, sans file extension:

Here’s the script - install into your Maya scripts folder and run “renameWithFilename” with any and all Files nodes selected. The script ignores other node types if you want to select everything in the Hypershade Textures panel.

1 note | Permalink

Script to Use V-Ray RT as Maya Multi-frame Renderer

Someone asked whether it was possible to use V-Ray RT as a playblast renderer in Maya so I looked into it. The always-helpful guys at Chaos Group got back to me instantly with a script to call in the “RT Image Ready” MEL callback in the Render Globals. I updated it to append the frame number with padding, made it write to a VRayRT_Playblast” folder and it’s been rolled into V-Ray Tuner. Check it out:

You have to set the first frame in the timeline, set your max frame render time in the RT Engine Settings. You’ll have to use a program like QuickTime Pro to make a movie file out of the frames, or jus load the sequence into Nuke or After Effects. Also, make sure to clear the RT Image Ready MEL after using or IPR renders will run the script (the bottom field should be blank):

I’ll work on clearing that automatically on cancel or completion.

0 notes | Permalink

OBJ Render Problem Warning - You Need This

Even after years of knowing to keep this in mind, I invariably find myself forgetting to enable reflections and refractions for OBJ meshes that have been imported into Maya. There is a longstanding bug (or at least an annoying default behaviour) where imported OBJ meshes have their reflection and refraction flags turned off. You have to turn these on for every object or else you won’t get reflections and refractions. Considering how prevalent OBJ files are as a go-between for apps like Headus UV Layout, Mudbox, ZBrush, etc., that’s a pretty bad problem. So, to save myself wasted time, I added this MEL script to my Render button in V-Ray Tuner. Grab the code here. Put it in your scripts folder and run it with “source render_with_warn.mel;”

It won’t prevent any rendering, but it will give me a warning that it found a mesh with the .visibleInReflections set to 0 and select the meshes. See it in action with a demo of the problem:

So, either grab the latest V-Ray Tuner from here or add that code bit to a shelf item for use with your renderer (this is also a problem with Maya Software, mental ray, etc.)

Update: someone was asking for a version of the script that would automatically turn those back on for all meshes, instead of just issue a warning. Here is a version of that script above that turns the flags on automatically before rendering. Run it with “source auto_fix_render;” If you know you don’t need those off for any mesh, it’s fine to use – otherwise, I’d recommend just run this script on the selected objects if you’re confident they should be visible.Drop it in scripts and run it with “objRenderFixer;

0 notes | Permalink

V-Ray Tuner 2 released – Updated for V-Ray for Maya 2.0

It’s done! After many new things being added and a serious upgrade of both my knowledge of V-Ray and my MEL skills, it’s a big improvement over the last version and includes many things specifically for V-Ray for Maya 2.0, which just went into public beta testing for people who pre-ordered it. Grab it here. The major changes are:

  • Added per-light pass rendering script. More on this below.
  • Made a material converter for V-Ray for Maya to V-Ray for Max (see end of this post).
  • Added sync light size and target rect lights buttons.
  • Added a bunch of little feedback things like GI readout on load/refresh and resolution settings. Lots of hot help added so look at the Help line and Script Editor feedback for new stuff.
  • Option to load V-Ray plug-in if it’s not loaded.
  • Quick LWFMe button to set up a linear workflow in one click.
  • Launch IMap Viewer from Utilities menu.
  • Added padding to right so scroll bar doesn’t crop in by default
  • Made menus with lots of stuff to save space.
  • Added another row of checkbox controls to some common features for animators. To keep it less confusing, I organized these logically in vertical rows according to areas they affect (DMC, Linear Workflow, etc).
  • Added LightMaps menu to give quick access to disk cache modes for Irradiance Map and Light Cache for animators. You need to set up the cache file paths first and then these work as expected. Feedback about which is active is given if you hit Refresh or change one of the menu settings.
  • Various V-Ray RT specific items added.
  • Added Maya2VRay material converter. All code for this written and supported by Paul Dreisen paul@dryzen.com. Thanks again, Paul.
  • Increased Max AA DMC samples slider for those using high values with Nederhorst settings or very high DMC adaptation.
  • Option to load Console.app from Utilities for render feedback for Mac OS X. In Windows, this is the Output Window (it was created because there is no stdout for Windows). Unfortunately, since there are so many different distros for Linux, there’s no way to pick one file that I can launch on Linux, so this is OS X only.
  • Updated Attach Cam procedure for V-Ray 2. It probably won’t work with 1.5 now.

Per-Light Rendering

This was created as an imitation of Maxwell Render’s Multilight, since I also use Maxwell and love that feature. The script goes through your scene and renders out a file for each of your visible V-Ray lights (don’t use Maya lights with V-Ray if you’re new to V-Ray) and saves them according to the light name (Dome, VraySun, environments included). The naming part is the reason for the Render Globals window opening (leave that open until it’s done). If you have meshes with V-Ray Light Materials in your scene, you simply have to select those before running the PerLightRender script and it will work with those as well:

For those unfamiliar with Maxwell’s Multilight or you’re having a hard time picturing this in a workflow, here’s a quick demo of how you would use it for still images as a “render once and tweak lights without re-rendering” scenario. I often use this when I don’t care to finalize the actual scene lights to perfection just to get a nicely lit image with a lot of lights (In the beginning of the movie, I’m just changing a bunch of stuff quickly to get rendering working faster and fixing my scaled lights):

It’s also a handy way to check light contribution since it can often be unclear what light is doing what within your scene. This method also works with global illumination, unlike the V-Ray 2 Light Select Render Element. You have to render to a 32-bit format for it to store light in floating point, so keep that in mind. The script also turns render elements off before rendering the lights, so you don’t get an absolute ton of images you don’t need (it restores your current render element on/off setting when it’s done). Photoshop and After Effects users, use Linear Dodge (Add) for compositing the layers.

The only limitation to this Per Light Rendering script is that the new V-Ray Material Self Illumination parameter is not checked and it also doesn’t check if you have a V-Ray Light Material in a Blend Material so if you are using those, it will render each frame with those in it, compounding improperly when you comp them. Nothing is changed in your scene, so don’t be scared to use this or the DaveBake420 script.

Target Light and Sync Light Size

Here’s a quick video showing these two button features:

DaveBake420 Script

This was added to 1.7.3 but I thought I’d quickly show it here for people who don’t know what it does:

I’ve used this script a lot already for making ambient occlusion textures for scene objects. It was used for my building, ground and planes in this illustration. Also, works well with my GoP script since that sends objects to Photoshop with the name as well.

The MaxScript V-Ray material converter is not ready for Windows/Linux. A Python port is being worked on so I hope to have that integrated in an update soon.

If this is the first time you’re using V-Ray Tuner and you’re wondering why it doesn’t connect attributes when scenes load, hit the Refresh button. This also acts as a way to read out your current scene’s V-Ray info that is also new:

V-Ray Info: Primary Engine is Irradiance Map, Secondary Engine is Light Cache. Lightmaps: IMap: Single Frame / Light Cache: Single Frame

Also, I want to change the menus to use checkboxes but these trip the script if your scene isn’t loaded and it tries to read non-existent nodes that V-Ray hasn’t created yet. Anyway, enjoy and, if you want to thank me for this script, find the nearest pug and pat him or her on the head. Mine’s waiting to be walked while I type this.

Update: the MaxScript converter now uses MEL so all you have to do is select the material, run the converter from the Materials dropdown and the MaxScript code is output to the Script Editor for copying and pasting into Max.

4 notes | Permalink

V-Ray Tuner 2 Per-light Rendering Done

It is done! I’ve taken the various pieces of MEL code and mashed them together like two handfuls of pureed potatoes and we have a winner:

All light types are working and the workflow is very straightforward. I just need to get it to respect hidden lights and it will be released soon. Don’t no one be disrespectin’ no hidden lights.

0 notes | Permalink

Another V-Ray Tuner 2 teaser. Meshlights now working with light passes

The mesh lights portion of per-light rendering passes is now working in my V-Ray Tuner 2 script:

Thanks to the people on CGSociety’s Maya forum for the help getting this bit working. Best Maya forum ever.

1 note | Permalink

V-Ray Tuner 2 teaser

I thought I’d show off a little thing I’m doing with the next version of V-Ray Tuner. I wrote a while back about rendering separate light passes with floating point EXR renders to get all the flexibility of Maxwell’s Multilight with V-Ray, and I’ve developed something that’s a lot more friendly than using render layers. Select your lights, hit “Render per light” (need a shorter name) and the script will render out an image lit only by that light and it will be named according to your light:

Yes, I know the render is noisy – I am just testing the script so the quality settings are quite low. And for people thinking “isn’t this what the Light Select Render Element is for?,” you’re close but that doesn’t include global illumination like this does. Anyway, after it’s done, your scene is restored and the images are ready to be composited. Animation people might find this to be overkill but I do stills, so I do this stuff a lot. It currently works with all V-Ray light types, domes, environment map GI, and I’m just working on support for material mesh lights and material self-illumination.

2 notes | Permalink

Both GoP and V-Ray Tuner updated

GoP update now works with object names so it’s easier to use with named renders like my baked V-Ray Tuner output passes:

The V-Ray Tuner is small but significant. I made a batch bake section and a “DaveBake420” command that takes all your selected objects and renders out baked textures for all active render elements. It even names the rendered image according to the object name. It needs a few things but it’s already saved me a lot of time. Check it out:

Same links as before:

GoP page on Creative Crash

V-Ray Tuner page on Creative Crash

2 notes | Permalink

V-Ray Tuner 1.7 posted

I updated my V-Ray Tuner MEL script today. It’s now an automatically docked palette in Maya 2011 and above. Pretty slick, if I do say so myself:

I plan on doing this by default for my new scripts. It’s a good way to save space and keep things out of your face. It also shows up in the right click UI elements menu:

I done hacked the Maya interface! 

0 notes | Permalink

In celebration of V-Ray for Maya 1.50 SP1, a gift from me!

I recently switched to V-Ray from mental ray for Maya after years of coping with the incessant bugs and awful support. The just-released update to V-Ray for Maya reminds us what an update for a renderer should look like – full of fixes and new features, and at no extra cost.

Anyway, fellow CGSociety members know that I’ve made a MEL script called “V-Ray Tuner” that enables quick access to some of the SP1 features like the V-Ray Framebuffer for OS X Maya 2011 x64:

The script works on all platforms and it’s free of charge. Grab it here and enjoy!

1 note | Permalink