slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Christopher Evans Technical Art Lead, Crytek PowerPoint Presentation
Download Presentation
Christopher Evans Technical Art Lead, Crytek

Loading in 2 Seconds...

play fullscreen
1 / 57

Christopher Evans Technical Art Lead, Crytek - PowerPoint PPT Presentation


  • 242 Views
  • Uploaded on

Christopher Evans Technical Art Lead, Crytek. Responsibilities: Artist in R&D Pipeline tools Character technology Digital Janitor. Mathias Lindner Technical Animator, Crytek. Responsibilities 3rd Person Human Animations Animation Tools Motion Capture. What is this stuff?.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Christopher Evans Technical Art Lead, Crytek' - Mia_John


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
christopher evans technical art lead crytek
Christopher EvansTechnical Art Lead, Crytek
  • Responsibilities:
    • Artist in R&D
    • Pipeline tools
    • Character technology
    • Digital Janitor
mathias lindner technical animator crytek
Mathias LindnerTechnical Animator, Crytek
  • Responsibilities
    • 3rd Person Human Animations
    • Animation Tools
    • Motion Capture
what is this stuff
What is this stuff?
  • A look at some scripted tools development at Crytek.
  • Beginner Maxscript Tutorial
    • Using example code from tools at Crytek
    • We started our maxscript journey from scratch
  • Crysis Scripted Tool Examples
  • A close look at the Animation tools/pipeline
intended audience
Intended Audience
  • Beginner to Advanced
    • Code examples in slides for beginners
    • Tool videos/source online for advanced
  • Technical Artists/Animators
  • Anyone who wants to work faster and better in 3dsMax
session overview
Session Overview
  • CryTools Background
  • Beginner Tutorial
    • Easy Street
      • Basics
      • Loops
      • Animation
    • Transformations
    • User Feedback
    • Hacking with DOS
  • Production Examples
session overview1
Session Overview
  • Animation Tools
    • Structure
    • Function definitions
    • Motion Capture Cleanup
crytools background
CryTools: Background
  • In the beginning: 2006
    • No scripted tools
    • No previous Maxscript experience (MEL)
    • Pipeline/Architecture built from scratch
  • Current: 2008
    • 14k+ of lines of code
    • used by artists/animators across 3 studios
    • 2 main contributors
  • Scripts load from latest build on local machine
    • Can also sync via Perforce/LAN/Http
  • Modular design based on users
    • Rigging, Animation, Art
crytools background1
CryTools: Background
  • Tools are freely available as part of the CryEngine2 ModSDK
    • SDK: http://www.crymod.com/filebase.php?fileid=1074&lim=0
easy street the basics
Easy Street: The Basics
  • Do Not Store Global Variables
  • To store things globally, make global struct

--my script

test = "hellow world“

print test

--total noob

--my script

(

test = “hellow world”

print test

)

--hardened veteran

easy street not so basic but important
Easy Street: Not so Basic(But Important!)

--creating the struct

struct _myTools_

(

fn function1 = (return "myFunction1"),

fn function2 = (return "myFunction2"),

var1,var2,var3

)

--instance your struct

myTools = _myTools_()

--testing your struct

myTools.function1()

"myFunction1"

myTools.var1 = "storeMe"

Print myTools.var1

"storeMe"

easy street the basics1
Easy Street: The Basics
  • Use the Listener/Macro recorder
  • Maxscript docs rock (go Bobo!)
  • Read other people’s scripts
    • www.scriptspot.com
  • Use the Debugger!
easy street the basics2
Easy Street: The Basics

showproperties $bone

.width : worldUnits

.height : worldUnits

.taper : percent

.length : float

. . . .

showinterface layerManager

Interface: LayerManager

Properties:

.count : integer : Read

.current : Interface : Read

Methods:

<Interface>getLayer <integer>which

<Interface>newLayer()

. . . .

easy street loops
Easy Street: Loops

for i=1 to 4 (m += 2)for item in array do (print item.x)for obj in selection do (append obj array)for obj in $C3D* do (obj.parent = $node)for i=1 to (polyOp.getNumVerts obj) do( append locations (polyOp.getVert obj i))

easy street loops1
Easy Street: Loops

--sometimes you want to start laterss = SplineShape pos:(obj.position.keys[1].value)addNewSpline ssfor i = 2 to obj.position.keys.count do( addKnot ss 1 #corner #line obj.position.keys[i].value)--or end soonerfor i=1 to (items.count-1) do( rotBind items[i] root 0 0 180 false)rotBind items[items.count] root 0 0 180 true

easy street simplification
Easy Street: Simplification

for obj in selection do( if (classof obj) == Sphere then ( if obj.wirecolor == red do ( obj.pos.z += 10 ) ))

easy street simplification1
Easy Street: Simplification

for obj in selection do( if (classof obj) == Sphere then ( if obj.wirecolor == red do ( obj.pos.z += 10 ) ))

easy street where
Easy Street: Where!

for obj in selection where (classof obj) == Sphere and obj.wirecolor == red do ( obj.pos.z += 10)

--another example, this puts all spheres into an array called ‘spheres’spheres = for obj in selection where (classof obj) == Sphere collect obj

easy street loop examples
Easy Street: Loop Examples

--if a selected object had a turbosmooth modifier change it’s prefs

for obj in selection do

(

if (obj.modifiers[#turbosmooth] != undefined) do

(

obj.modifiers[#turbosmooth].iterations = 1

obj.modifiers[#turbosmooth].useRenderIterations = true

obj.modifiers[#turbosmooth].renderIterations = 2

)

)

easy street nested loops
Easy Street: Nested Loops

--this removes bones in an array from a skin modifier

for u=1 to remBones.count do

(

for i=1 to (skinOps.getNumberBones obj.skin) do

(

if (skinOps.GetBoneName obj.skin i 0) == remBones[u].name then

(

skinOps.removeBone obj.skin i print ("removing " + remBones[u].name)

)

)

)

--how can we simplify?

myBones = for i=1 to skinOps.GetNumberBones obj.skin collect \ --cont next line (skinOps.GetBoneName obj.skin i 0)

for i=1 to remBones.count where (finditem myBones remBones[i]) != 0 do

(

skinOps.removebone obj.skin (finditem myBones remBones[i])

)

easy street animation time
Easy Street: Animation/Time

--stepping through frameswith animate on( for i = animationrange.start to animationrange.end do ( slidertime = i obj.pos.x += 10 ))--same as above, but much fasterwith animate on( for i = animationrange.start to animationrange.end do ( at time i (obj.pos.x += 10) ))

easy street functions
Easy Street: Functions

fn cutString stringIn cut =( startCut = (findString stringIn cut) return (replace stringIn startCut cut.count ""))--simple usagecutString “chicks dig technical artists” “ technical”“chicks dig artists”--more complex(getnodebyname ((cutString obj.name "C3D:") \

+ "_bone")).pos.controller = Position_XYZ()

easy street self referencing
Easy Street: Self Referencing

--returns an array containing all childrenfn getChildren theNode =( nodeArray = #() for obj in theNode.children do ( append nodeArray obj join nodeArray (getChildren obj) ) return nodeArray)

transformations
Transformations

$.transform(matrix3 [1,0,0] [0,1,0] [0,0,1] [23.1612,0.667526,0])[-----orientation-----] [-----position-----]--maxscript cannot set parts of a transform like so:$.transform[1] = [1,0,0]--but this will work:new = $.transformnew[1] = [1,0,0]$.transform = new

transformations dealing with biped
Transformations: Dealing with Biped

--let’s get the position of a biped object

print $'Bip01 Head'.position

-- Unknown property: "position" in $Editable_Mesh:Bip01 Head @[-25.684864,-37.348450,118.445419]

--fail, ok let’s check out what properties does have

showproperties $'Bip01 Head'

false

--again: fail… when all else fails, go the transform

print $'Bip01 Head'.transform.position

[-25.6849,-37.3484,118.445]

other tips variables
Other tips: Variables

a = 5

b = a

a += 2

print b

5

a = "ftw"

b = a

a[3] = a[1]

a[1] = "w"

print b

"wtf“

--this is because of how subsets are stored in memory

--for data-types that are groups of items (strings, arrays, etc) use ‘copy’ instead, example:

b = copy a

other tips
Other tips:

--try/catch

try (print $.name)

catch(print “nothing selected”)

--reach into rollout floaters to pass vars

myTool.rollouts[1].variable

--create undos

Undo "make point" on

(

point name:"test"

)

--is an object animated?obj.isAnimated

--getting a position at a certain timeprint (at time 11f obj.pos)

altogether better user feedback
Altogether:Better User Feedback

On checkbutton changed state do

(

if state == true then

(

if selection != undefined then

(

objs = (selection as array)

checkbutton.text = (objs.count as string + “ objs selected”)

)

else

(

messagebox “No objects selected”

checkbutton.checked = false

)

)

else

(

checkbutton.text = “Select Objects”

)

)

--sample ui in course materials

altogether better user feedback1
Altogether:Better User Feedback

On checkbutton changed state do

(

if state == true then

(

if selection != undefined then

(

objs = (selection as array)

checkbutton.text = (objs.count as string + “ objs selected”)

)

else

(

messagebox “No objects selected”

checkbutton.checked = false

)

)

else

(

checkbutton.text = “Select Objects”

)

)

--sample ui in course materials

altogether better user feedback2
Altogether:Better User Feedback

try

(

throw "This will be the name of your error"

)

catch

(

messagebox (getCurrentException())

)

--you could also use this to write out error logs on remote machines, have people send them to you when they get an error (or automatically send it)

hacking things in dos
Hacking Things in DOS
  • DOSCommand [command <string>]
  • CryTools has a silent command line fn
    • crytools.scmd [command <string>] [wait? <bool>]
  • Many general uses
    • Moving files
    • Perforce, AlienBrain
    • Glean info from ipconfig (domain, ip, MAC)
    • Get external info
    • Run small executables
      • Hash generator
    • Building/Executing external scripts
      • VBS/Python
dos example 1 simple
DOS Example 1: Simple

--This function will make a file writable, I use this a lot before writing to files.

fn minusR path =

(

if doesfileexist path == true then

(

doscommand ("attrib -r \"" + path + "\"“)

)

else

(

print (path + " does not exist")

)

)

getting info from dos
Getting info from DOS
  • First figure out the DOS command
    • Dump generated text to a file with ‘>’
  • Then look at it’s output
    • Figure out how you want to parse it
getting info from dos1
Getting info from DOS
  • Then look at it’s output
    • Figure out how you want to parse it
dos example 2 output
DOS Example 2: Output

fn local2unc letter =

(

cmd = ("net use " + letter + ": > " + sysInfo.tempDir + “cmd.txt")

doscommand cmd

loadIn = openfile (sysInfo.tempDir + "local_unc.txt")

skipToString loadIn "Remote"

loadInARR = (filterString (readline loadIn) " ")

close loadIn

doscommand ("del " + sysInfo.tempDir + "local_unc.txt")

return loadInARR[2]

)

local2unc "s"

"\\storage\Builds"

local2unc "k"

"\\fs1\Artists"

dos example 2 output file
DOS Example 2: Output file

C:\Documents and Settings\christopher\Local Settings\Temp\cmd.txt

Local name S:

Remote name \\storage\Builds

Resource type Disk

Status Disconnected

# Opens 0

# Connections 1

The command completed successfully.

--tidbit from experience: people install DOS in different languages ;)

callbacks
Callbacks!
  • Do things based on user input
  • Always remember to unregister!

fn myFn =

(

theFaces = 0

for obj in selection do (theFaces += obj.mesh.numfaces)

print theFaces

)

--register

callbacks.addScript #selectionSetChanged "myFn()" id:#myFn

--unregister

callbacks.removeScripts id:#myFn

crytools examples
CryTools: Examples
  • Transfer Facial Morphs [ transfer_morphs.avi]
  • Mirror Morphs/Deformation [ mirrorMorphs.avi ]
  • Hierarchy to Bones [ hierarch2bones.avi ]
  • Hierarchy Tools [hierarchy_tools.avi]
  • CryInfo [ cryinfo.avi ]
in closing
In Closing
  • Maxscript helped immensely on Crysis
  • Scripting is a slippery slope
    • One day you write a script to help someone, the next it’s your job :)
  • Screw efficiency
    • If something works, and is fast… let it be.
    • Refactoring can be dangerous
    • CryTools has a lot of ‘beginner code’, but very few tools that take longer than an eyeblink to execute.
animation tools
Animation Tools
  • Overview
    • Structure
      • How we used structures
    • Function definitions
      • How we used functions
    • Motion Capture Cleanup
      • Problems and solutions
animation tools1
Animation Tools
  • Structures
    • Are declared in global scope
    • Initialized with defined values
    • Structure name is self-explaining
    • Good for instancing variables in a structured way
    • Behave a bit like classes
    • Used about 60 different structures
  • Example

structpivotSelSt(index =0, position =[0,0,0],pivObject)

structbipPartSt

(

object,

part,

name,

pivotSel =(pivotSelSt pivObject =undefined )

)

animation tools2
Animation Tools
  • Function definitions
    • Structure placeholder will be overwritten by function
    • Global functions get removed
    • Function name is self-explaining
  • Example

cryTools.cryAnim.getBipNames = function getBipNames index =

(

...

)

getBipNames = undefined

animation tools3
Animation Tools

cryTools.cryAnim.getBipNames = function getBipNames index =

(

...

)

getBipNames = undefined

  • Advantages
    • Easy to maintain (for development)
    • No need to look at local scope of functions
    • Function can be defined outside of the structure
  • Disadvantages
    • Functions will be duplicated once = more time to load
animation tools4
Animation Tools
  • Motion Capture Cleanup
    • Problems we encountered
      • Slow workflow for Animators (lots of repeated clicks)
        • Bad for health and time management
      • Too technical to achieve code requirements
        • Animators had trouble to get used to constant changes
      • No feedback when something went wrong
        • Endless time spent with debugging
animation tools5
Animation Tools
  • Motion Capture Cleanup
    • Solutions:
      • Everything repetitive needs to be gone
        • Packed functions executed at once
        • Designed tools to speed up the animation process
      • Powerful User Interface
        • Self-explaining functionality
        • Compact set of tools
animation tools6
Animation Tools
  • Motion Capture Cleanup
    • Everything repetitive needs to be gone:
      • One Click Solutions
        • Simple scripts just for the purpose
        • No user interface needed
      • Examples:
        • Set planted keys for biped (video)
        • Copy Paste Transformations (video)
animation tools7
Animation Tools
  • Motion Capture Cleanup
    • Everything repetitive needs to be gone:
      • Batch process for animations (video)
        • Use of different file formats
        • Sub folder support
        • File mask
        • Execute scripts to solve different problems
        • Status report
animation tools8
Animation Tools
  • Motion Capture Cleanup
    • Powerful User Interface:

Goals:

      • Fast production of assets
        • Compact functionality in one place
      • Animator should not care about technical things
        • Solutions for complex bone behavior
      • User Customization
        • Animator can change the look and functionality of dialogs
animation tools9
Animation Tools
  • Motion Capture Cleanup
    • Powerful User Interface - Solutions:
      • Fast production of assets
        • Fast loading and saving of assets (video)
          • Load files directly out of the production folder
          • Export files into the game
        • Using snapshots for foot alignment (video)
          • Speed up hand and foot cleanup
          • How it works (video)
animation tools10
Animation Tools
  • Motion Capture Cleanup
    • Powerful User Interface - Solutions:
      • Animators should not care about technical things
        • Locomotion Locator animation(video)
          • Used for linking the animation to the character in-game
          • In some cases complex behaviour
        • Weapon / Item adjustment (video)
          • Specific bones to carry weapons / items in the game
          • Rotation and position can change for each item
animation tools11
Animation Tools
  • Motion Capture Cleanup
    • Powerful User Interface - Solutions:
      • User Customization
        • No hardcoded values / states
        • Dialog should represent the needs of Animators
        • Easy to add new elements
animation tools12
Animation Tools

Normal

Multi Row

  • Motion Capture Cleanup
    • Powerful User Interface - Solutions:

(video)

slide56

Full Source of Examples at:www.ChrisEvans3D.com/files/fmx08.rarCrytools/Source at:www.ChrisEvans3D.com/files/crytools.rarShould be up by 12/05/08

slide57
Questions or comments via email?Christopher EvansChris.Evans@Gmail.comMathias LindnerMathias_Lin@Hotmail.com