Boats on the Chao Phraya River, Bangkok

Time lapse photo of boats navigating the Chao Phraya.

Boats on the Chao Phraya from oliver wolfson on Vimeo.

My Maximum PC May 2010 Cover

Maximum PC May 2010 Cover

Acuvue Product Launch Video

Created at Elastic Creative in San Francisco. I was tasked with texture, lighting, and rendering.

Rename multiple files with Mac shell script

Simple renaming and renumbering script for multiple files

num=0 for j in *.jpg do mv "$j" `printf "myFILE.%05d.jpg" $num` num=`echo "$num + 1" | bc` done

Usage: In any text editor, modify the script so that the extension in the second line (here .jpg) exactly matches the extension of the files you want to modify. Also, change the file name in line four (here myFILE) to whatever name you want to use. In the Terminal, cd to the directory with your files. Paste the script to the terminal, hit enter.

Note, the way this is set up, the script will rename every file of the specified .extension in the current directory.

Replace file name suffix:

Another script. This script changes the suffix of each specified file in a directory. In this example from “myName_000_01.JPG” to “myName_000.jpg”

for i in *.JPG do mv $i `basename -s _01.JPG $i`.jpg done

Edit the the first line of the script so that it works on the appropriate files. In this example we have several files that have the extension of .JPG in common. Each of these files will be renamed.

The “mv” unix command is used to rename the files. Using the “basename” utility and the “-s” flag we can designate what part original name we want to keep, rather the suffix we want to remove. In this example the suffix we want to remove is “_01.JPG”.

Specify the new suffix that you want to add (here it’s “.jpg”).

Next, open a terminal window. Navigate to the directory where your files reside. Enter “sh” in the window, hit enter. Paste the script, and hit enter. That’s it.

scripts written with the assistance of Jeshua Lacock of OpenOSX.com

Creating a Maya batch render script

Creating a Maya batch render script for a PC using Windows has always been straightforward in my experience. You simply write a text file with the following code:

render /path/to/myFile.mb

Make the file executable by changing the extension to .bat. Double click the file to launch the render.

The renderer will use settings that were selected when the project was saved. Those settings can be over-ridden with render flags. See Render Flags below for render flags and options.

For the Mac, it can be slightly less straightforward. Follow these instructions, found on Autodesk, The Area

Issue

You are on Mac OS X and you want to render several files one after another using a batch script.

Solution

To batch render multiple scene files, you need to create a shell script, for example: myRender.sh.

1. Using a text editor (Applications > Textedit), enter the render command for each individual scene on a separate line.

#!/bin/bash
Render –r sw scene1.mb
Render –r sw scene2.mb
Render –r sw scene3.mb

In some cases, you may need to enter the complete path of the Render command. It is located here:

/Applications/Autodesk/maya2009/Maya.app/Contents/bin/Render
(of course, different for later versions of the software)

2. Save the file on your desktop as: myRender.sh.

3. You will need to change the file permissions of myRender.sh to 755.

Open the Maya Terminal (Applications > Autodesk > Maya2009 > Maya Terminal) and type:

chmod 755 /Users/YOUR-USERNAME/Desktop/myRender.sh

4. Now run the script from the Maya terminal by typing:

/Users/YOUR-USERNAME/Desktop/myRender.sh

(note! A shortcut to typing file paths in the terminal: Just drag the file to the terminal window!)

Code:

#!/bin/bash /Applications/Autodesk/maya2009/Maya.app/Contents/bin/Render -rd /path/to/render/output/folder /path/to/myFile.mb

Render Flags

Render flags are “options” code. For example in Render -rd, -rd is the flag, which allows you to set the exact render directory, i.e. where your rendered images will be saved.

Render -rd /path/to/render/output/folder

Do a search in the help for more render flags (options):
render -h in the terminal.

/Applications/Autodesk/maya2009/Maya.app/Contents/bin/Render -h

Popular Render Flags:

-proj
#Use this flag to ensure you are rendering to the proper project: -proj /path/to/projectDirectory

-s, -e
#specify start and end frames: -s 0 -e 100

-r
# Specify renderer: -r mr for mental ray (or : sw, hw, etc)

-rt
# Render threads, specify number of cpu threads, I use -rt 8 for my Mac Pro Quad (Mental Ray only)

-rl
# Specify render layer by name: -rl layer1

-cam
#Specify camera to render by name

-rd
# specify render image path: -rd /path/ to/image/folder/

-im
# specify image name: -im myImageName

If you are using Render layers use the following flags and setup:

-rl boolean|name(s)

Set up like this:

Render -rl layer1 /path/to/file1.mb
Render -rl layer2 /path/to/file1.mb

More info on render flags:

Maya render flags: http://www.pdipierro.com/tutorials/MayaRenderFlags.html

Also see
http://oliverwolfson.com/maya-render-settings-file-name-prefix/

Maya fresnel texture connections MEL script

Connect this network to the reflectivity attribute of a shader to get the fresnel effect, ie reflections that increase in intensity as the rendered surface turns away from the camera.

Use this script to generate the fresnel network. Connect the ramp’s outAlpha to the Reflectivity attribute of your material.

string $myRamp = `shadingNode -asTexture ramp`;
string $myNode = `shadingNode -asUtility place2dTexture`;
connectAttr ($myNode + ".outUV") ($myRamp + ".uv");
connectAttr ($myNode + ".outUvFilterSize") ($myRamp + ".uvFilterSize");
removeMultiInstance -break true ( $myRamp + ".colorEntryList[1]");
setAttr ($myRamp + ".colorEntryList[0].color") -type double3 .5 .5 .5 ;
setAttr ($myRamp + ".colorEntryList[0].position") 0;
setAttr ($myRamp + ".colorEntryList[2].color") -type double3 0.1 0.1 0.1 ;
setAttr ($myRamp + ".colorEntryList[2].position") 1;
setAttr ($myRamp + ".interpolation") 4;
string $mySamplerInfo = `shadingNode -asUtility samplerInfo`;
connectAttr -f ($mySamplerInfo + ".facingRatio") ($myRamp + ".uCoord");
connectAttr -f ($mySamplerInfo + ".facingRatio") ($myRamp + ".vCoord");

Select a material that has a “Reflectivity” attribute then run this script. The proper connections will be made automatically.

string $selShader[] = `ls -sl`;
string $myRamp = `shadingNode -asTexture ramp`;
string $myNode = `shadingNode -asUtility place2dTexture`;
connectAttr ($myNode + ".outUV") ($myRamp + ".uv");
connectAttr ($myNode + ".outUvFilterSize") ($myRamp + ".uvFilterSize");
removeMultiInstance -break true ( $myRamp + ".colorEntryList[1]");
setAttr ($myRamp + ".colorEntryList[0].color") -type double3 .5 .5 .5 ;
setAttr ($myRamp + ".colorEntryList[0].position") 0;
setAttr ($myRamp + ".colorEntryList[2].color") -type double3 0.1 0.1 0.1 ;
setAttr ($myRamp + ".colorEntryList[2].position") 1;
setAttr ($myRamp + ".interpolation") 4;
string $mySamplerInfo = `shadingNode -asUtility samplerInfo`;
connectAttr -f ($mySamplerInfo + ".facingRatio") ($myRamp + ".uCoord");
connectAttr -f ($mySamplerInfo + ".facingRatio") ($myRamp + ".vCoord");

connectAttr ($myRamp + ".outAlpha") ($selShader[0] + ".reflectivity");

Falling Diamonds

Part of a Thai music video in tribute to Petchara, a star of the 60′s, and featuring Weir, a current star. I was tasked with adding cg diamonds falling from above.