Tuesday, July 23, 2013

VFX Films - Pacific Rim

FxGuide has a great interview with Industrial Light & Magic crew members.
For me it was interesting to hear that ILM just started to use Houdini as a major tool for effects like destruction. Also huge that they switched to use Arnold as a primary render solution. I think they had a couple of TD's on board.


Maya Tools - Locator size by scale

In Maya it can cause a problem if we scale objects like camera and lights. For eg. camera imagePlane.depth attribute is affected by scale value. I had a situation when render output was a empty black image because camera (transform node) was scaled. But of course it is much easier to scale than look up the locatorScale attribute on cameraShape for instance.

So here is an easy primitive python script to adjust locatorScale based on transform node scale.

 selectedObject = cmds.ls(sl = 1)[0]  
 scaleVal = cmds.getAttr(selectedObject + ".s")[0][0]  
 cmds.setAttr(selectedObject + ".s", 1, 1, 1)  
 cmds.setAttr(cmds.listRelatives(selectedObject, shapes = 1)[0] + ".locatorScale", scaleVal)  

Okay, it can produce tons of errors if you don't use it properly. I'm going to write a function (a real tool) to check errors. I guess it will be at least 40 lines instead of 4...so the post title was kind of a bluff.
Recently I have been thinking a lot about how to simplify error handling.

Monday, July 22, 2013

Customizing Maya 1. - Overriding default right-click menu

I always wonder why this default right-click menu in Maya. I think developers made an useless function on purpose. "Customize it! Otherwise there is no reason to use."
So how can we customize default right-click menu in Maya?

First of all we have to know almost the whole maya UI is written in MEL (Maya Embedded Language). That means you can modify it extensively. Second, there is a concept of overriding and that means you don't have to actually modify the original .mel scripts just have to have a modified copy of those. I have a post about Maya customizing overview where you can read more detail customizing Maya paths. The default location template (on windows based on the official maya document) to place override scipts is the following:

drive:\Documents and Settings\username\My Documents\maya\version

You can query the actual maya script paths with a simple mel command:
getenv MAYA_SCRIPT_PATH

It returns the maya script paths list (MSPL) which starts with the custom maya script path (CMSP) and there is somewhere the default maya script path (DMSP). The template for DMSP is:
/application folder/scripts/

Overriding basically means copy the .mel file what you want to modify under the CMSP. Maya will recogzie two .mel script with a same name, and it will read the customized one (because it is the first path in MSPL).
Just have to know which particular .mel script is the one you have to modify to utilize custom default right-click menu.


Because it described in a .mel script which is basically a text file, you can searh for the word or words to find the script file. I this case the right-click menu has a menu item "Complet Tool" and this is enough to find the file.
Personally I use Total Commander to handle the file system so I can search not for the file name but the text.


You are going to find the buildObjectMenuItemsNow.res.mel. But! Maya .mel files often have a .res.mel version. Those file basically collect the texts which are displayed on the maya UI. It is managed by the uiRes mel function.
For us right now the important thing is we have to copy buildObjectMenuItemsNow.mel file under the CMSP because this is the file we want to modify.
This .mel file has a part which is exactly like a marking menu .mel file. I don't want to talk to much about managing marking menus but ask if something not clear.
The main issue with buildObjectMenuItemsNow.mel to replace the current menu items and/or add more.
So the important part of the code originally look like this:

 setParent -menu $parentName;  
   
 menuItem  
     -label (uiRes("m_buildObjectMenuItemsNow.kSelectAll"))  
     -radialPosition "S"  
     -command ("SelectAll");  
   
 menuItem  
     -label (uiRes("m_buildObjectMenuItemsNow.kCompleteTool"))  
     -radialPosition "N"  
     -command ("CompleteCurrentTool");  
   
 setParent ..;  
   

And we can replace menuItems like this:

 menuItem  
     -label "Outliner"  
     -radialPosition "N"  
     -command "OutlinerWindow";  
       
 menuItem  
     -label "Graph Editor"   
     -radialPosition "E"  
     -command "GraphEditor";  
       
 menuItem  
     -label "NodeEditor"   
     -radialPosition "S"  
     -command "NodeEditorWindow";  
       
 menuItem  
     -label "Set Editor"  
     -command "setMembershipEditor"   
     -radialPosition "W";  

Personally I prefer to arrange menuItems clockwise. That is why -radialPosition starts with "N" (north) and after "E" (east) and so on.




Footnote:
Usually there is an easier way to find a .mel script based on the procedure name. Turn on Echo All Command in Script Editor below History menu or push the button on the toolbar.

Now if you try default right-click menu it will return in the script editor history panel something like this:
buildObjectMenuItemsNow "MayaWindow|formLayout1|viewPanes|modelPanel4|...|modelPanel4ObjectPop";
We can use whatIs xyz.mel statement to check a mel procedure source. If you type:
whatIs buildObjectMenuItemsNow;
And the result would be something like this:
// Result: Mel procedure found in: C:/Program Files/Autodesk/Maya2012/scripts/others/buildObjectMenuItemsNow.mel //
You will notice Echo All Command can produce tons of code lines in the history panel depending on what you are doing. So if you are confused you can use the method described earlier.

We can use buildObjectMenuItemsNow.res.mel file to manage -label names of course. For this case I would not recommend that.
To find out more about Marking Menus just search for it on the internet. There could be sub-menus if you use -subMenu flag. To close the sub-menu you have to use setParent -m ..;. It is clever to indent the code to visualize where the sub-menu start.

 menuItem  
     -label "Editor Windows"  
     -subMenu 1  
     -radialPosition "N";  
                       
     menuItem  
         -label "Outliner"  
         -radialPosition "N"  
         -command "OutlinerWindow";  
       
     menuItem  
         -label "Graph Editor"   
         -radialPosition "E"  
         -command "GraphEditor";  
           
     menuItem  
         -label "NodeEditor"   
         -radialPosition "S"  
         -command "NodeEditorWindow";  
           
     menuItem  
         -label "Set Editor"  
         -command "setMembershipEditor"   
         -radialPosition "W";  
       
     setParent -m ..;  


For bored Maya TD's 1.

We all know if we create a curve and place an object on it using motionPath there will be two positionMarker node to indicate the first and last frame of the animation.


I just recognized these nodes are called something like this:

curveShape1->positionMarkerShape1
curveShape1->positionMarkerShape1

And guess what: you can select them like this:

select -r curveShape1->positionMarkerShape2;

or like this as well:

select -r positionMarkerShape2;

And if it is not enough: the time attribute of the positionMarker adjust the animation length as well. I've never used it before.

For me it was an interesting because I tested a python script which called IsShape and I wanted to check whether it produces an error with positionMarkers. More about about this here.

This positionMarker / motionPath setup rised another question. Is it possible to place only a positionMarker on a curve manually? As we can see if we use the menu function "Attach to MotionPath" it calls a mel command pathAnimation. Because it is not a .mel script I can't find out what it does exactly
I tried like this:
createNode positionMarker;
connectAttr -f positionMarkerShape1.time motionPath1.positionMarkerTime[0];
We can say this setup is close but not enough :)

Can somebody reproduce what "Attach to MotionPath" menu command do with positionMarkers mannually?

Thursday, July 18, 2013

For Maya TD's - IsShape

How can we know about a node whether it is a shape or not?
The problem is that in maya shape as a node type does not exist.
So I wrote this python script:

 def IsShape(Selection):   
     shapeNodeList = []   
     for node in Selection:   
         if cmds.nodeType(cmds.listRelatives(node, p = 1, path = 1)) == "transform" and cmds.nodeType(node) != "transform":   
             shapeNodeList.append(node)   
     return shapeNodeList  

The idea behind this if a node is not transform but the parent node is, that particular node has to be a shape. I could not produce an error yet (of course there has to be a selection).
Is it correct or somebody has a better idea?

Wednesday, July 10, 2013

Jargon 1. - VFX, SFX, PFX

I find myself use VFX, SFX, PFX in a special meaning. It might be because as a VFX guy I talking a lot about VFX and things like that with other VFX guys and there are some kind of unwritten definitions. But not really sure for eg. how an SFX guy is talking about SFX.

I think VFX usually used as digital visual effects nowadays.
SFX (Special Effect) can be the effect which is not digital, usually fire, smoke, dust, sparks, etc., but basically can be anything (special).
PFX (Practical Effect) can be physically created models that can be driven, moved or something like that. Because the VFX is getting more and more popular we might forget that creating a move is basically make the illusion. And this illusion if it is not digital made physically. I found recently an amazing reel about PFX or so called Animatronics.





I made this video just for fun. I think it is a good explanation of what making the illusion means.




References:
http://en.wikipedia.org/wiki/Vfx
http://en.wikipedia.org/wiki/Practical_effect

Let me know what do you think about these abbreviations.

Monday, July 8, 2013

Art Versus Technology

I was always confused what I was supposed to be rather a technician or an artist. My conclusion it really cannot be separated especially if we are talking about VFX. It is more likely art has a technical or scientific part. That can be analyzed described and taught. The other part...well for me that is more like transcendent. Because VFX stands for visual effect the first question is always, what? What it would be look like or what is the creative goal? That we can describe as an artistic part of the business. The second question is, how? How can we achieve that look or image? That is the technical part.
We can say art has a technical part but we not really say that technology has an artistic part. For example you can't say "art of programming". You might use that expression if you want to sell your book.
As a technician in VFX (so called TD) your role is to support artists. As an artist you have to understand the technical part of the business.

A long time ago I visited an exhibition of Gustav Klimt's drawings. For me it was a proof that great artist has a perfect technical skills.
Here is a drawing from 1879 at his age of 17.





I think he knew everything what can be known about drawing. And the other hand I think this picture is not described as a great artistic achievement.
Here is another picture form 1916.



If you have the skills and the knowledge you are free to create art.
About VFX I have to tell you the bad news. You have to follow the technologies no matter you are an artist or TD. Softwares and workflows rapidly changes. What you know today might be obsolete a year after. Of course in the other hand you might be able to work better and faster.

Wednesday, July 3, 2013

VFX Films

You might read my introduction about VFX. Over the years I had the feeling Hollywood filmmakers went crazy. It might started with Jurassic Park or Godzilla but nowdays the best actor in leading role is VFX. Spectacular visuals were always a requirement for big Hollywood style movies but recently the trends are make it even larger then ever before.
So how big the main evil can be? There were Godzilla (1998) and Cloverfield (we can call it Godzilla II., 2008)  and Clash of the Titans with Kraakan  (2010),  Wrath of the Titans with Kronos (2012). I hope they won't give up here and Pacific Rim can prove it monsters could be even larger. And...oh yes, here they come, Godzilla again (2014). I saw lot of talent sold their soul but I was a bit amazed when I found Juliette Binoche on the Cast list.
I started to thinking about films I have seen and VFX was supporting the story instead of leading that. If we consider VFX could be done not only digitally I have to start my list with Tarkovsky Nostalghia (1983). I'm going to write about jargon of the industry, but right now here is a cutty list about film which have spectacular digital VFX in supporting role:
The Devil's Advocate (1997)
Dark City (1998)
Fear and Loathing in Las Vegas (1998)
Fight Club (1999)
Eternal Sunshine of the Spotless Mind (2004)
Tree of Life (2011)