ramblings from an overworked mind

Latest

vrayControl

I’ve been doing a lot of Vray work lately and decided to build a tool to quickly manage settings from one UI. It also runs a scriptJob to automatically update the filename prefix for multichannel EXR files when animation mode is enabled (by default, Vray will not add a separator between the prefix and the frame number which can become incredibly irritating). It also has the beginnings of a shader and HDR environment library browser.  Right now you can dynamically load shaders from the UI from a set library location on your network (there can be more than one location). I’m still debugging it, but the next version will allow you to add any shader from the HyperShade window to the library and render a preview icon with Vray Standalone.

Expand the archive into a folder, and add this code to a button in the Maya UI (set the shader and presets path variables that you will be using – these can live anywhere, locally or on a network drive)

http://www.michaelfessenden.com/downloads/vrayControl.rar

{
string $shaderPath ="../vrc_shaders";
string $presetsPath="../vrc_presets";
source "vrayControl/vrayControl.mel";
vrayControlUI($shaderPath , $presetsPath);
}

This is still a work in progress…more coming soon

Asset Manager – Python

Asset Manager 2 - Maya UI

I’ve begun work in earnest on the Python version of Asset Manager.

It’s much more ambitious than the first version, leveraging Python, MySQL and PyQt. It currently works in Maya and Nuke with a common interface (hence the removal of “Maya” from the script name). Currently I’m focusing primarily on defining the show and asset Python classes, as well as designing the database.

The nice thing about using a database is that I can basically chuck the first version’s heavy reliance on Maya optionVars to parse data quickly (reading the metadata from disk was painfully slow at times) and now the core of the application isn’t specific to either Maya or Nuke (as Nuke has no equivalent to an optionVar). Currently, the Nuke module reads and writes os.environ values to a text file to maintain settings and preferences between  sessions.

The source code is hosted on Github. It’s still heavily in the design phase and a little messy, but is getting updates weekly.

https://github.com/mfessenden/vfx-assetmanager

mf_geoCache

This is a tool to add a more functional geometry caching pipeline by augmenting the features already built into Maya. To use, add whatever geometry you want to cache into the cache list, check the frame range and press the ‘cache objects’ button. It will cache the objects into the folder specified (it will autofill the textField the current projects’ data folder and the current file name). It caches any mesh or nurbs object, even those unaffected by deformers. By default, it will create a lambert1 shaded clone of whatever objects you have cached (with the caches attached) and put them under a new ‘cacheGroup’  group for easy export. This still uses the internal Maya caching system, but adds some extra information to the cache XML  file to facilitate easier importing later on.

The apply cache features are pretty useful for a small studio. The browser searches whatever directory is specified in the search path for caches and attempts to match them to objects in your current scene. You can even specify a model to be referenced to apply the caches to, or update current scene caches with a newer version.

http://www.michaelfessenden.com/downloads/mf_geoCache.rar

Fixing VRay for Maya OpenEXR naming behavior

If you’ve ever used Vray for Maya you’ve undoubtedly come across this annoying quirk: when rendering to OpenEXR – the format of choice today for multipass rendering – Vray breaks the default Maya behavior of automatically separating the image prefix from the frame number with a period (“.”). To rectify this, you can add a couple of lines to the end of the procedure vrayTransformFilename (depending on the version of Vray you are using it’s approximately line 164) in the script vrayCreateCommonGlobalsTab.mel:

string $imageFormat = `getAttr vraySettings.imageFormatStr`;
if ($imageFormat == "exr (multichannel)" || $imageFormat == "exr"){
    if (!`endsWith $transformedFilename "."`){
     $transformedFilename = ($transformedFilename+".");
    }
}

Now when Vray updates the image file prefix in the render globals tab, it will first query the image file format and add a trailing period if the format is OpenEXR.

Maya Asset Manager

This is a project that’s been taking a lot more of my spare time than I’d like, but it’s been a great exercise in really understanding how 3d assets should be managed throughout a show.

It began life as as a geometry caching tool I built for a film I was working on. Because of an extremely tight schedule, we only had time to build a rudimentary character pipeline for the show, and the lighters were referencing in character animation – rigging, fur and all. After spending a lot of time troubleshooting broken scenes, I decided to start putting together tools to alleviate some of the hassle for lighting. After the show was finished I decided to take what I’d learned and build a more ambitious tool to manage the pipeline for a short film I’ve been working on in my spare time with friends.

The primary function of this tool is a model and material manager, aimed for use at smaller studios.  Models are automatically cleaned up and tagged with custom attributes before being submitted into the pipeline ‘ materials are stripped off and saved separately. Assets can be checked out and resubmitted by the artists, all the while they are automatically numbered and copied into the artists’ work directories. Metadata for each asset is stored in XML files that are used to maintain versioning.

The custom attributes persist all the way through rigging and/or dynamics, so that if an animator submits his animation, assets in the scene are automatically cached. With one click, lighters can reference all the assets for their shot including the camera; geometry caches are automatically applied. Riggers can work with only the grey shaded models while lighters can call in the materials with one click.

The first version is a little rough, but very functional.  It was written entirely in MEL so it was a little slower than I’d like, but I’ve rewritten and optimized some of the core procedures  in Python which has sped up the performance. Currently this is written for  Linux only due to the reliance on shell scripts (it can function in Windows with Cygwin, but I’ve not thoroughly tested it. OSX can use the tool as well, but again I’ve not tested it for any significant amount of time). Instead of faffing about with Windows command line functions, I’ll just rebuild the next version with Python for all platforms.

Directory Parsing

The core of this tool is the directory parser. The admin sets up the root directory location in the prefs, and the Asset Manager takes it from there. Whenever the user clicks on a menu in the UI, the tool automatically finds the current directories for all ‘asset classes’ for the particular asset (ie: model, rig, material, dynamic rig) and sets an optionVar for Maya to use in it’s core procedures. The optionVars persist even when Maya is closed and are only recreated when needed, speeding up a lot of the unnecessary disk searching that might otherwise happen.

Show directory parsing interface

The default setup gives suggests default directory locations, but the admin is free to customize them to their directory structure. They can also tailor the asset categories and classes.

Model & Material Manager

The second function of the tool is managing models and materials. Models get submitted into the pipeline with attributes assigned that designate shading group assignments. Shading group sets are saved off automatically when a model is tagged or checked in, furthermore, shading group sets can be arbitrarily saved off at any time from any shot’the new sets are tagged with scene and renderLayer information. This easily allows the user to save off a custom shader set for a particular shot or render layer, should it need to be recreated in another scene.

Versioning

Model, material and rig version are tracked throughout the pipe. When any asset is referenced into a scene, an unknown node is placed in the scene with information that tracks the history of the asset from when it was placed into the scene. When material sets are applied, that is appended to the node allowing which gives the user the ability to track the history of any asset in the shot. The system isn’t perfect, but it is useful when something goes wrong with a referenced asset ‘ information on which model, rig or model/rig version was used is retained, allowing the user to version backwards to an asset that did at one point work in the shot.

Since Asset Manager data is stored in unknown nodes and attributes, scenes and assets can be transferred between studios without reliance on an external plugin.

Model Cleanup

Models are flattened, construction history is removed, normals are checked and a polyMoveVertex operation is applied to each shape to reset it’s vertices. Materials are saved off into a separate file which can be called back at a later date. This was done so that when materials are applied in a shot, they will respect shading overrides on existing render layers. When a model is referenced or checked out, materials are automatically applied for the user so no extra steps are required – the process is transparent to the user. To facilitate this, I wrote a very robust sets managing library. A “materials” set is created and saved with each model; contained sets are named after the shading group that was originally applied to the members of each set. When the model asset is checked out or referenced by an artist, the matching material file is imported as well and applied to the model. While this is in no way a complete solution, it has worked very well for our scenes, and gives the artists a little flexibility to change shaders in their lighting scenes without worrying about shader connections being broken in render layers.

Extras

Asset Tagging UI

Some of things I’ve built in to the tool are automatic rendering of 1k imagePlanes in Nuke when a shot is initially setup.

On-the-fly generated shell scripts to customize the pipeline for different shows (only works in Linux and OSX at the moment).

When you submit a model with shaders, file textures are copied to a central textures folder for that show and the file nodes are updated on the fly.

To Do List

There’s a long list of things I’d like to do with the tool; first and foremost is to read and write show/asset data to a database for speed. Currently all metadata for things like models, shots and shows are stored in invisible files in the relevant directories which works, but has some obvious disadvantages if a user inadvertently deletes a file or directory, that data is lost. The latest version does contain a library file with procedures for rudimentary CSV reading and writing, and I’ll be expanding on those in the future.

The check in/check out feature is also fairly robust, but wouldn’t stand up if used by a medium to large team of people. Ideally I’d like to hook it into a system like SVN to handle the processes of versioning and establishing ownership of the assets in the pipe.

Installing

To install, extract the archive into a directory (ideally on a network drive where others can access it). You need to set a Maya environment variable ASSET_MANAGER_LOC that points to that directory. Copy this code and save it as a button:

{
string $assetMgrLoc = `getenv "ASSET_MANAGER_LOC"`;
eval("source \""+$assetMgrLoc+"/am_startup.mel\";");
am_startup("assetManagerUI");
}

Download the script here:

http://www.michaelfessenden.com/downloads/assetManager.rar

Back from the dead…

It’s been awhile since I’ve updated my blog, but it’s been a pretty busy year for me in both my work and personal life. Since my last posting, my professional life has been in overdrive…I went back to CafeFX for  a year to work on Night at the Museum 2 and G-Force. It was a great year and I met some really cool people who’ve become friends and inspired me professionally. For the past three months I’ve been at work on a new movie with Brendan Frasier called Furry Vengeance as the fur lead at Furious FX in Burbank. After this I hope to take some time off and travel a bit, though I’m sure something will pop up to stop me…

Using nCloth to deform more complex objects

This was something I built for Digital Domain recently. The challenge was to create dynamic palm trees for a shot where the trees would extend out of a platform and move realistically. The idea was, that at the push of a button, a canyon would open up to reveal a golf course. The trees were going to be bound up and shoot upwards through the green

Having had a lot of luck previously with nCloth, I decided to use it in lieu of Maya’s softbody dynamics. The problems arose when I realized that the frond objects needed to be fairly detailed and would slow down the simulation significantly.

To get around this, I built a sheet approximately the same size as one of the fronds, and in the same orientation. The sheet became an nCloth object, constrained to the tree trunk and positioned randomly. The fond objects were parented to sheets so that their start positions would match. I then unparented everything and used the sheet as a wrap deformer for the frond objects. The hires geometry was assigned to its own layer for preview speed, and the rest of the work was adjusting the rigidity of the ncloth objetcs – which previewed very quickly with the frond geometry hidden away in another layer. There were also some flare deformers added to help bind the tree up into it’s start position – part of the beauty of Maya is how it allows you to stack deformers on top of deformers without blowing up your objects.

The resulting animation holds up extremely well even under close, scrutiny. I was pleasanty surprised with how well it turned out. Unfortunately, the client decided that they no longer wanted to have palm trees but instread wanted more sand bunkers, but I think this was still a valuable exercise.

Gluing an object to a component

This has bugged me forever, and I finally stumbled upon the answer by accident while working on a routine smoke shot today. Clusters don’t obey transformations and deformations, so how do you just stick something easily to a component?

I almost have a mel script that does this, but the simple answer is to select a vertex/face/edge and just emit particles from it. You can delete the particle object, and just use the emitter as a transform node.

Easy as pie.

Mark Ecko Shoe commcerial

Mark Ecko - Wide View

An offshoot of the Vanessa Hudgens “Sneaker Night” video that we recently did (coming soon), this was a commercial spot for the Mark Ecko sneakers that she wore in the video. I was tasked with building the sneaker with great detail because it had to come close to the camera at 2K. This was a tough one in many respects because of all the detail I had to model in. To make it more manageable I broke the sneaker into patches and detailed each one as I went.

Mark Ecko - Heel

The base mesh was modeled in modo, with displacements done in ZBrush & Photoshop. For the stitching, I had to model a few stitches in modo and bring the model into ZBrush, from there I created a custom alpha brush that was modified from the Stitch preset. It turned out pretty good, though I had to make some tweak in Photoshop before it look exactly as I wanted it.

Light trails were again done in After Effects, though the final sequence was composited in Shake.

Mark Ecko - In Motion

Base mesh from modo

Painting stitching in Zbrush

Shader override passes in RfM 2.0

Maya’s render layers are…problematic.

Some of our Renderman scenes had been losing their render globals tabs when the scene was saved with render layers, and because I love a challenge I decided to see if I could circumvent the Render Layer system and create a pass with a shader override -a task I would normally accomplish with a Maya render layer. RfM 2.0 supports Maya render layers and can set layer overrides for most prman nodes and attributes, but not for the render globals so it calculates each pass for each layer. If you have a subsurface object and an environment light in the scene be prepared to wait awhile while you raytrace occlusion or color bleeding for your characters’ subsurface pass. This sort of defeats the purpose of making separate passes. The solution? Make your own custom Rman pass.

Create a new Final pass, call it whatever you want. On the Pass Settings tab, add the following attributes:

Expand Surface Shader

Custom Shading Group

Uncheck Expand Surface Shader and add a shading group to the Custom Shading Group attribute; add a shader. If need be, attach a current shading group node and connect the SG message to the rman__torattr___customShadingGroup attribute – make sure to show hidden nodes before you do this in the relationship editor. Here’s the shader I sometimes use:

surface occlfunction(float samples = 256, maxvariation = 0.02)
{
normal Ns = faceforward(normalize(N),I);
float occl = occlusion(P, Ns, samples, "maxvariation", maxvariation);
Ci = (1 - occl) * Cs * Os;
Oi = Os;
}

Not so fast there, you’re not out of the woods yet. I used occlusion as an example here primarily because it’s a pass that you need to invoke ray tracing for, where your other passes you might not need it on. You’d think that just adding a “ray tracing” attribute to the occlusion pass your just created would be enough to make the pass render correctly, but it will error out with a message that ray tracing needs to be on. Set it on in the globals and add the ray trace attribute to your beauty pass and uncheck it. Seems a little backwards, but your scene will now render its passes correctly, and only trace those passes that you check it for.

Lastly, be careful using the command “delete unused nodes” in the hypershade; any shaders you’ve assigned directly to Rman passes will be deleted.

RfM Pass Settings

Renderman for Maya’s does have some shortcomings though; for example a custom pass will still receive shadows from objects that aren’t rendered, though you would expect them to not be affected by invisible objects.