Demo

The Make Art Button:
Batches, Actions and Scripts
Adrian Woods
Technical Art Lead
ACES games group
Microsoft Game Studios
Who am I?
• Technical art lead for ACES games group at
Microsoft (Flight Simulator, Train Simulator, Etc.)
• Managed assets for the entire world!
• Thousands of models.
• Thousands of textures.
• Thousands of legacy files that need to be upgraded.
• Thousands of lines of MaxScript.
“Established game studio seeks
Technical Artist…”
• Admittedly not the most sexy topic at GDC. But it’s
becoming more important daily.
• Content demands are increasing exponentially in
both quality and quantity.
• Three years ago, technical artist wasn't really a
position at any studio. Now there's one or two in
every studio.
• How to keep up? Focusing your time on the
creative content rather than the repetitive content.
Rule of three.
• Do something once, it's creative. Do something
twice, it's annoying. Do something 3 times, it's
manual labor.
• Can also be known as: If you do the same thing
three times in a row, you're likely to do it again
and again later on.
• Or… If you've done it three times manually, find a
way to automate it.
Overview
• The dreaded DOS prompt:
– A few tips and tricks to get the most from this
ancient, but powerful operating system.
• Photoshop Actions and Droplets:
– How to create them with examples.
– Photoshop scripting?
• MaxScript
– What you can do with it.
– Sample tools.
– The make art button in action.
• Questions?
The DOS prompt can be your
friend
• When in doubt, get “help”
– Gives you help for all known commands.
– Shows you the switches and context for the
command.
No really, the DOS prompt likes
you.
• “>” is a great tool.
– Pipes output to a file.
– File can then be manipulated with excel or
notepad.
• Results in:
Excel likes you as well.
• Which can quickly and easily be turned into this
using find and replace commands:
• Which can be saved as a batch file that renames
all of the “bump” files into “normal” files.
But the DOS prompt "likes you“
likes you.
• Extra Credit: The For loop
– Intro to programming using DOS.
– Very powerful, relatively easy to learn.
– Easy to mess up as a novice. Always work with
backup files if you’re renaming or deleting.
• For Example:
– C:>for /R %i in (*bump.psd) do copy %i
C:\Xfer\GDC2006\RenameBumps\
– Is how I copied all the bump maps from our build
into a single directory.
Using the FOR loop
• Simple FOR loop:
– FOR %i in (*.psd) do echo %i
– Will print out the name of each .psd file.
Similar to “dir *.psd”.
– FOR %i in (*.psd) do mkdir %~ni&copy %i %~ni
– Will make a directory for each .psd filename
and then copy the .psd into that directory.
Using the FOR loop
• Extra, Extra credit: More advanced FOR
loops:
– FOR /F "usebackq delims=bump" %i IN (`dir /b
*.psd`) DO copy %ibump.psd
Result\%inormal.psd
• Using FOR loops with IF statements:
– FOR /F "usebackq tokens=1,* delims=_;" %i IN
(`dir /b *.psd`) DO IF NOT EXIST %i (mkdir
%i&copy %i_%j %i) ELSE copy %i_%j %i
Photoshop actions
• Actions are a simple scripting language in
Photoshop.
• Record the set of steps in the actions
window.
Each of the recorded steps with
parameters
Pause Action
PlayNew
Action
Action Set
Record Action New Action
Delete Action
Stop recording
Photoshop actions
• Demo: Creating a simple normal map filter
action.
• Actions can be called from within other
actions (Meta and Uber actions)
• Demo: Creating an action that contains
other actions within it.
Photoshop actions
• Photoshop has a
powerful batch
command that can
perform an action
on a whole set of
images in a
directory and / or
its subdirectories.
Photoshop Droplets
• Droplets are basically
actions that have
been turned into an
.exe and can be run
from outside of
Photoshop.
• Great for processing
texture information
from the command
line (like in build
scripts).
• As easy to create as
batches.
Photoshop Droplets
• You can drag and drop files onto the droplet
.exe and it will process them.
• When running from command line, the full
image path name must be called.
• Because you need the full path name, the
for loop works great for calling droplets on a
bunch of files:
– C:\>for %i in (*.psd) do FromGreyToBump.exe
%~fi
Photoshop Scripting?
• Actions are limited to “hard-coded” operations. This limits their ability
to deal with variables.
Notice hard-coded names
• With CS, comes scripting for Photoshop.
• Very powerful and can handle variables.
• JavaScript language. If you’ve worked on it for the web, you can
probably pick it up quickly.
Photoshop Scripting!
• Photoshop has a whole reference library for
the JavaScript commands that work in
Photoshop. (Adobe Photoshop
CS2\Scripting Guide\JavaScript Reference
Guide.pdf)
• If you put scripts in Adobe Photoshop
CS2\Presets\Scripts, they will show up in
File>Scripts menu.
MaxScript
• If you can do it in Max, you can generally
automate it in MaxScript. (There just may be a
really convoluted way of getting there.)
• The listener is helpful, but most real commands
don’t show up in the listener.
• Use other people’s scripts and the help reference
as well. (3dsMax7\help\maxscript.chm)
• Don’t run the .chm from within Max, it will crash.
(How nice.)
MaxScript
• Max 8 finally has a debugger! Yay!
• We’re stuck on Max 7 until we ship. Nay!
(So I won’t be able to cover the debugger
too much.)
• MaxScript can be used in a variety of
different ways.
• “What ways?” you ask…
MaxScript
• MaxScript can be used to create simple
tools from already existing Max tools.
• Demo of the Create Half-Pipe tool.
• This toolset should be a part of the GDC
materials. So you can pull it apart and see
how I wrote it (as well as make fun of my
bad artist code.)
MaxScript
• MaxScript can be
used to recreate
original Max
functionality that
is poorly written
or badly designed.
• Demo of FSX
Shader tool.
MaxScript
• MaxScript can be
used to manipulate
UVs.
• Demo of UV tool
suite.
MaxScript
• MaxScript can be used
to create LOD viewers,
verification tools, build
interaction tools, and
other powerful and
time-saving tools.
• Demo of the Export and
LOD tool.
MaxScript
• MaxScript can also be
used to create
methods of storing
game information in
your Max scene.
• Demo of the Attach
Point Tool.
The Make Art Button...
In action!
• Demo of an actual make art button:
– From a single footprint, it is possible to
create a building in Max…
– Pass the UV’d and rendered texture to
Photoshop…
– Where a series of droplets create a
usable texture sheet…
– Which is then passed back into Max as
the object texture sheet.
– And a finished simple building is the
result.
The Make Art Button...
In action!
• A similar (and much more elaborate)
technique was used to create all of the
background buildings in New York for
King Kong.
• Perfect for those areas where you need
to fill the skyline, but don’t have the
manpower to hand-create every object
needed.
• Similar techniques could be applied to
foliage or the ubiquitous “crates”.
Maya?
• MEL is also a very powerful scripting
language.
• Almost anything you can do in Maya, you
can automate with MEL scripts.
• A little more like a programming language
than MaxScript, but still relatively easy to
learn (especially if you already know
scripting basics).
Questions?
• Q & A.
• Ask me anything.
• If I don’t know the answer, I’ll make up
something that sounds convincing.
• Thanks for sticking around this late on a
Friday.