Cult of Rig : Season 00 day 002 Components and Interfaces

 

season 00 day002 stream components, Interfaces

Day 2, components and interface first for encapsulation of components.

Components and interfaces:

  • Isolation of components
  • Few streams leading up to SIGGRAPH and first season will be after SIGGRAPH

First Principles

  • Encapsulation is one of the most important parts of object oriented programing and building interfaces.
    • Components require figuring out how they fit together or connect to each other
    • Public and Private concept
    • Interface First – think of how the users will interact with the content and design based on that.
  • Rig example: Wheel with spokes
    • In and out for each component
    • Contract or agreement for the component interface is that they will only connect from an Component Out to -> Component In
    • Animators don’t use “Maya” as much as they use the “Rig”, the rig is their Software (the public part of the component).
    • Component connections are a concern for the TD not the animators
  • Private area of the component would be anything that a tool or script manages and you don’t want people aware or messing with it… space switching systems for example

QA on an how to think about IK solver in a component

 

Maya Example 26:44

Example but not a hard and fast rule

  • wheel_M_cmpnt
    • input
      • localWorld_srt
    • output
      • wheel_srt
    • control [animation transform icon nurbs curve ]
      • wheel_M_main_ctrl_srtBuffer
        • wheel_M_main_ctrl
    • guide [ something to change the build + attributes to change settings ]
    • deform [joints, clusters]
      • wheel_M_wheel_srt ( node type is joint)

 

Don’t over build a component interface so for example a Master World node (god node) just needs an output

  • godNode_M_cmpt
    • output
      • master_srt
    • control
      • godNode_M_master_ctrl_srtBuffer
        • godNode_M_master_ctrl

 

Connections between Input and Output systems are done with direct connections vs. constraints. based loosely on the “contract” for our components as connections between them.

 

godNode_M_master_ctrl.worldMatrix-> decomposeMatrix-> godNode_M_cmpt |output|master_srt

… now we send godNode component output to wheel component input node

godNode_M_cmpt |output|master_srt -> wheel_M_cmpnt| input|localWorld_srt

now the wheel_M_cmpnt| input|localWorld_srt -> wheel_M_cmpnt| control |wheel_M_main_ctrl_srtBuffer

Rigging Dojo Note: This seems confusing at first but it simply creates a system of connections that is still based on the “contract” setup at the start that states each component will only connect to each other through OUTPUT and INPUT. In this way once you have a value coming into the components input then you can get that and send it to the animation control part of your component making sure the controls move together and stay zeroed.

When using decomposeMatrix or other nodes that sit between the two components they are or can be though of as  underworld node.
This means here that they are not part of components (you can use Maya Name Space Editor )  but you can to assign a nameSpace like “underworld” to keep track of those connecting nodes between components.

 

Now the final pass will be to send out the “deform” connection from the component to the wheel geo.

wheel_M_cmpnt| control|wheel_M_main_ctrl_srtBuffer|wheel_M_main_ctrl.worldMatrix   -> decomposeMatrix -> wheel_M_cmpnt|output|wheel_srt

Now we need to have the wheel control sending world transform from the component to a “joint” now in the system

wheel_M_main_ctrl.worldMatrix   -> decomposeMatrix -> wheel_M_cmpnt| deform|wheel_M_wheel_srt  (our deformation “Joint” )

Encourage the reusing our underworld decomposeMatrix node that is creating the component output and also sends over to the deformation part of our component.

Now our joint can direct connect to a transform node above the geometry or you could skin the mesh to the joint…etc…

 

Rigging Dojo Note: We hope the rough transcript outline and notes help new TDs dig into the great information and opportunity to learn from Raf.

 

Get involved:
Follow me on twitter for announcements and news
https://twitter.com/ThE_JacO
Follow the Streams live on Twitch
https://www.twitch.tv/cultofrig/
And keep up to date with news on the website
http://www.cultofrig.com

 

Cult of Rig : Season 00 day 001 Naming and Components

season 00 day001 stream – namingAndComps

What the first Season will be about:

  • Show was inspired by HandMade Hero format
  • Few streams leading up to SIGGRAPH and first season will be after SIGGRAPH
  • New rig every season getting more complex
    • Season 1 will be rigging  a Unicycle in Vanilla out of box Maya
    • How to organize the rig
  • Performance is a big part of this “The absolute #1 important thing in a rig”
    • Check out what can be a bottleneck
    • If we hit a node we are missing we will write it
  • Escalation of concepts- not just a button combo of clicks and “named” technique taught as if they were something special. Learning the maths and ideas and design of a rig
  • Start with the simple rig needs and as we hit something like algebra or a need for vectors, we will dig into them piecemeal.

First Principles “8:00”

  • Rig by first principles – something you assume to be true and base your thinking on.
  • Have to be simple and bullet proof basic building blocks.
  • Nothing should drop the performance of a rig unless necessary. (feature vs. performance)
  • Great ideas that are slow don’t get adopted (clunky demos) so make them fast

Rig organization – Naming Conventions

  • Not a matter of opinion (despite your opinion of them 🙂  but don’t follow along blind, explore your own and try it out
  • First principles of naming
    • Names will be strings
    • Facts about strings
      • CPU string processing is slow
      • No long tokens at start of string (token discrete element or name)
        • component_side_ etc_extension or type
        • Note: “Type” is what it should be used for not just what it is “loc” example , DON’T DO THIS
        • Instead the “Type” is what the node is doing, not what it is – examples – “hrc” (hierarchy separator or spacer ) “srt” (scale rotate translate) “srtBuffer” (aka zero or offset or pivot)”leg_R_something_srt”We will look at Apps Hungarian notation as reference
      • Edges of the string are fast to get to in code
        • First block “leg” will be fastest part of string compare
        • End block is second fastest, “FK” checking the string
        • block length doesn’t matter, doesn’t have to be 3 char for example.
      • Capitalization  use  “lowerCamelCase”
      • _L_ _M_ _R_  vs. _Lf_ _Rt_ _Md_  etc.. doesn’t matter really it just depends on how you want to do it and how many things you have to describe, what do you do if you have more than just left and right?
      • Name spaces vs. separators? Need to use Name spaces to fully get use out of Maya but the problem is that the tools to deal with them are or can be buggy.
      • NAME shouldn’t have any effect on what happens to the node or what the node actually does on the back end.
      • NAME should be able to made sense of if you have to work through the rig during trouble shooting or tracking down a bug.
      • Context Matters (hiearchy + name) can help make sure you know what the nodes are doing.
      • Remember the name is also for the animators and a good naming convention will help them know what they have selected and what they do and how much space they take up in the graph editor outliner so understand when and where to be flexible.
      • Question – What about fingers or spine Numbering?
        • “hand_L_[finger01_knuckle]_srt or fingerKnuckle_L but more of this will be covered in the next video talking about how to break the rig in to components

Rigging Dojo note: “There is an argument for not putting a buffer node above controls that will be in world space” I will disagree here because of how many cases where having animation be relative to a transform node and not the world is such a great thing,  that we will recommend you buffer any animation control nodes. You could argue that you can always move the data to be relative and bake the animation it back out to world but that is a time cost that isn’t worth it.

Rig organization – MetaData 59:00

  • Names can act as redundant work but don’t replace or should be used as MetaData
  • Have as much redundancy that doesn’t cost performance as possible.
  • MetaData can be a source of problems or get broken, causing TD to have to troubleshoot by hand or repair from the name but name isn’t only source.

Intro to components:

  • For you to organize the rig
    Example: Bike
    Wheel + Fork/frame + pedals
  • Help with evaluation of graph not just pure visual
    • What order do you want the components to drive each other
      • Pedals drive wheel?
      • Frame moves Wheel and updates pedals?

Rigging Dojo note: “Raf digs in to some examples on circular logic but the core concept is good component design allows for more flexibility in changing relationships AKA having easy space switching or layers of drivers that don’t break.
Picking what and when is in charge like a multi way constraints
Raf hits a point where he gets to the point of why and what he really means with not labeling techniques like “Broken Hierarchy” or “Flat Hierarchy”  He doesn’t have formal names for this part due to the existing names not being clear so he would call a “Flat or a non-hiearchy” a WIDE vs. DEEP hiearchy.   It can’t be a hiearchy if it is flat and it isn’t Broken hiearchy because it works and it isn’t a hiearchy either. We Actually agree here that being stuck on the  names for things and not being mindful of or creating meaningful ideas of what is really there “seeing the rig” vs. getting stuck on a technique name.

Wrap up QA

 

Get involved:
Follow me on twitter for announcements and news
https://twitter.com/ThE_JacO
Follow the Streams live on Twitch
https://www.twitch.tv/cultofrig/
And keep up to date with news on the website
http://www.cultofrig.com

Cult of Rig

This is going to be a must watch source so spread the word and show support and follow Raf on Twitter https://twitter.com/ThE_JacO

We have had Raf on our A.I.R video series and he showed us all a glimpse of how he thinks about rigging and performance, this new stream looks to be a PHD level of learning depth aimed at all skill levels.

“Join the Cult”

logo_inverted_small

Cult of Rig is a series about character rigging based on first principles, intended to show how to produce high performance, feature rich rigs from absolute scratch.

Everything needed will be covered on a per-need basis as we go, in a very accessible manner, with little technical know-how required to join; from mathematics to programming to how DCC software works under the hood, as well as anatomy and kinesiology (much) later on.”

Broadcast times:

Get to know: Stephanie Wagner – Rigging TD MPC

Stephanie came to us already very talented and skilled and went through our Python 101 course. We are happy to have been able to contribute to her training and help make her even more efficient. Join us in our interview with her and if you want to read about another talented character TD check out our past interview with Gio Coutinho – Rooster Teeth Productions

Welcome Stephanie Wagner Rigging TD  MPC  and Rigging Dojo Almuna.

 

 

Let’s get started with a bit of background about you, and what led you to computer graphics and rigging as your specialty?

I have always had a technical and artistic curiosity. I created my first website when I was around nine years old and played around with Ubuntu Linux in my teens. One day I was watching a video game “making of” and was fascinated by a cgi arm in motion. After watching a ton of videos and reading up on the subject I applied and was lucky enough to get an internship at a motion-capture company called metricminds where I learned a lot about the animation pipeline. I also enrolled into the Games Academy – art & animation class where I was involved in rigging and animating characters for student projects.

At first I found it challenging to learn rigging but it quickly became the field I felt most passionate about. I really enjoyed the structural, problem solving element of rigging and loved the feeling when it all came together.

Can you share your learning curve and experience over the years as a TD, from starting out to working on new tech and across different studios.

During the first weeks working at MPC I was determined to learn as much as I could about working with the pipeline and understanding procedural rigging. I also needed to learn a lot more about anatomy since I was responsible for a muscle digital double rig. I tried to ask as many questions as I could to get myself up to speed and found this was the best way to improve. Working closely together with a lead really helped with learning the inhouse tools, improving my anatomy knowledge and my workflow in general. I enjoyed deformation rigging the most and specialized more in this field. Over time I became confident placing anatomy, using deformers and setting up simulations which has become my strength and passion. I really benefit from sharing knowledge and brainstorming with colleagues which I find to be the most rewarding aspect of being a TD.
In general Every studio has a different approach and a different tool set available to their artists. Overall it does not take a lot of time to start working using inhouse tools and conform to a new rigging pipeline. Being exposed to various tools helped me grow as a TD and broadened my skillset.

 We talk a lot about model topology and the default pose to rig, do you have a preference?

A relaxed and symmetrical pose is preferable meaning slightly bend legs, arms and fingers. However if I get a model in a different pose I like to adjust it to my needs and rebind the skinCluster in some cases. I also like to adjust the topology if I have to or add some more details to certain areas such as armpits.

If you adjust the pose do you then have to send it back to modeling? What is the back and forth process look like then with the other department?

Usually I receive very good models to begin with and the changes are very minor. The model in it’s default pose is usually matched to reference from the client and can’t simply be changed. Adjusting the pose in rigging – to create a perfect tPose for example – is not a change that needs to be picked up by modelling since I can save different poses in the rig itself.

If anatomy or topology needs to be adjusted in the beginning of a project I can always propose reasonable changes and get the model updated by modelling. Towards the end of a show it usually is much quicker to adjust the model in the rig directly and add the changes as a front of chain blendshape.

Deformations are always a balancing act between character design, topology and animation needs.  How do you approach skinning and final deformation work?

It’s essential to get your pivots right. I usually lay out my joints quiet roughly and do a test bind to find the right placement of the joints. I also like to place actual skeleton geometry in my rigs to find the best joint position.
If I am skinning a character for an animation rig I take a bit of an old school approach. Classic linear bind, 1 max influence set to interactive skinWeighting. I block in all the weights from the core to the limbs. Afterwards I set my max influences to 2 to 3 and use the paintWeightsTool to smooth the skinning. For polishing I set the max influences to 20 and use the weightHammer. I try not to use too many helperJoints to keep the animation rig as fast as possible.

For a simple deformationRig I like to add some helperJoints to the rig. On top of that I sculpt correctives for better volume preservation and to create more interesting deformation. It does not take a lot of time to slide the topology around, move some edges out to create wrinkles and sculpt a bit of a flexing biceps shape for example.

If I had to do a setup in vanilla Maya I would create a shape in the default pose, do a blendShape and control the envelope with drivenKeys. To make it more interesting I would apply a cMuscleNode and add some relax, smooth and slide attributes.
Most importantly for rigging deformation is having a bit of animation going on. A simple technical workout (elbow rotate in/out) while skinning or sculpting gives you a perfect idea of how the character is deforming in motion and if your weights/shapes are holding up between poses.

You have done a large number of really great creature and animal muscle systems, can you talk about the process and what non-software specific tips readers could use to learn or prepare for a job doing that.

Besides working with great tools and technology It mostly comes down to a good foundation, experience and an eye for deformation.

A foundation can be build up by studying anatomy, drawing muscles on top of a character – this will tell you a lot about muscles in motion. Looking at characters in (slow-)motion to learn about shapes of muscles, what they look like flexing. You slowly develop an eye for deformation and why some CG feels good or wrong. Sculpting can also be very beneficial to develop a sense for volume and proportion. Practicing will make you more confident and only benefit your work.

If you want to dive into deformation rigging I would recommend to take a certain body part, e.g. the arms and really try to understand the human body in motion. Just to get some questions out there: where do I need to connect the biceps muscle to create a nice flex? Why is there a dimp in my shoulder when I lift up my arm? How do the ulnar and the radius function? How does the deformation of the lowerArm change when I lift my finger up?

Great references:

  • Planet Earth 2
  • Animal Anatomy For Artists by Elliot Goldfinger
  • Human Anatomy For Artists by Elliot Goldfinger
  • Anatomy For Sculptors by Uldis Zarins & Sandis Kondrats
  • Bammes

 

Can you talk about your approach tacking on a character from scratch vs. taking over a character from another artist.

If I get the chance to do a character from start to finish I firstly take the time to roughly plan my schedule for each step required (jointLayout, skinCluster, muscleRig, correctives,…), look at reference and mostly work with range of motion animation until animation picked up the character. I usually try to get the character deformation to 90% final as fast as possible to have enough time to polish and work on feedback from the supervisor or further animation requests. Doing the last 10% usually involves working on details and dynamics which really bring the character to life but take up a little bit more time than the other 90% in my experience.

It is rare to take on major fixed from other characters. My leads usually try to keep the same person on their task. If a person leaves or is busy on a different show fixes can always vary from changing constraints, adding more controls or doing  a simple model update. In vary rare occasions I have picked up a first pass deformation rig and reworked the muscleLayout up until the final deformation. From my experience TDs usually leave their work in a good place and it is easy to update/improve their work. Even though naming conventions might be different from artist to artist most of us have a similar work flow.

 

Code vs. Visual rigging systems- You took our Python 101 course at one point, do you still do much scripting as part of your daily job?

I mostly use scripting as a tool to make my day more efficient. I have a few lines of code for this and that, things I find myself doing a lot such as wraps, creating base meshes, clusters, etc. everything that saves me a couple of clicks.

I personally like to do scripted deformationRigs since it makes it easier to handle model updates or use the script to build a different character in the future. Scripting procedural props, facial- and controlRigs goes without saying in the companies I have worked for though.

Do you use any publicly available scripts or tools when rigging?

The first tool I download when I start a fresh Maya is “comet” – of course! If you don’t have it, get it. It is a life and time saver. Besides that I always found brave rabbit to be a great source for tools. I personally don’t use ngSkinTools but a lot of riggers really love it. Definitely worth a try.

How much stock Maya vs. studio tools are you using?

I am mostly using inhouse tools for rigging my characters (from orienting joints to final touches). That said I find myself using a lot of the maya modelling tools, transfer attributes, etc on a day to day basis.

Anything you wish would get fixed or changed in the software to improve production work and make it easier?

It would be great to see Autodesk reinventing/supporting a new muscle system. It can be very challenging to tackle cMuscle and there is only little help around on the internet and barely any documentation. The cMuscle binding is not very intuitive, cMuscle overflows the outliner nodes and the sculpting of a muscleShape is very limited.

Do you see any major advancement in rigging for characters in the near future or are the techniques mostly standardized now?

Knowledge is constantly being passed on in companies and there are a lot of ambitious TDs pushing the standards of rigging on a daily basis. SIGGRAPH is a great example for this.

I do think that the core process of rigging is mostly standardized now, but there is a lot of room for improvements. I think we are all aiming to create fast, intuitive control rigs and outstanding deformation. Understanding motion is challenging and I am very excited to see what will be achieved in the future.

What have you found , training wise to have been the most helpful to you growing as a character TD? Any last tips or advice you can give to someone that wants to improve their skills as a TD?

When trying to solve a problem I always go back to pen and paper and write down the issue along with solutions that come up on my mind. I find this very beneficial to staying focused and finding the easiest and fastest approach. This brings me to the best training you can do: ask questions. Ask yourself, the internet and colleagues. The Maya documentation is actually the best resource when trying to improve your understanding of Maya. Understanding what is going on in your rig is very rewarding when it comes down to debugging or improving on existing tech. It is very simple but in my opinion the most essential advice I can give.

I personally enjoy watching reels/tutorials on vimeo to get inspired by other TDs or just to see a different approach to an issue. I also like to watch documentaries about animals in my spare time to learn more about their movement/deformation.

Another helpful method is playblasting your rig in motion and taking a critical look at it – even better if you have real life footage playing along with it. If you have quicktime you can scrub forth and back through the timeline to see if the deformation feels anatomical correct. I often find myself playblasting and updating a certain area several times before I am satisfied with the result.

Lastly and more on a personal level. Don’t be shy – feel free to approach people online or offline to get advice. Be hands-on! If you don’t like the topology or default pose – change it. Be confident in your work, try not to be arrogant (it will make you easier to work with). Be passionate about the work you do and enjoy it.

At Rigging Dojo we get a high percent of female students and some of our most successful students have been women. If at all, has gender had an effect on your career and do you work with a balanced crew or is it mostly a male crew?

First of all I had the pleasure of working and meeting some amazing and very talented woman in VFX studios. No matter if it is production, a technical or artistic position – a lot of woman are not only good at their job but also very organized, friendly and easy to work with.

Nowadays there is already a lot of woman in VFX. However I would love to see more woman in technical and leading positions overall.

Even though the rigging department is mostly a male crew there is always more or less a handful of female riggers in the team. From my experience a lot of the girls showed a lot of interest in deformation rigging, but others were really ambitious about scripting and control rigging.

I think the position of a Rigging TD appears to be a very technical job until you take a closer look at it. It is a very versatile field in which – mostly if you are in a larger company – you can focus on a subject that really interests you. Some of these are more artistic than others, but scripting and coding can also be seen as a tool to create something beautiful. In the end the technical part of the job is very creative in itself.

Is there something that you see missing in current TD skills or reels?

First of all, I am very guilty of the following myself and I wish had known a few of these points when I put my first reel online 😉

Most rigging reels start with a tPose bipedal character, showing an IK/FK switch, moving the hip around and rushing through the foot poses often followed by three minutes of showing other characters with the same functionality. It seems like a good idea to show that you understood the basics of rigging but does not show anything out of the ordinary. Rather take the time to show that you have build a solid rig and/or found a solution for a specific issue.

I would much more prefer seeing a reel showcasing two to three of someones best pieces, all animated and presented well. A range of motion is quiet easy to animate and viewport 2.0 is a good tool to present a rig. There definitely needs to be enough time taken in the reel to see the deformation of the work and highlight one or two specialties of the rig or an autorigging tool.

Last question – what book are you reading right now or last finished?

I fell in love with Stephen King when I discovered his novel “11/22/63” and finished “Misery” a couple of months ago. After reading several of his books over the past few years I started “American Gods” by Neil Gaiman to give a different author a shot 😉

How can people best find you online?

It’s easiest to give me a shout on linkedin or vimeo, but for a general impression of my work it’s worth taking a look at my website: http://stephiewagner.weebly.com/

Thank you for your time

 

 

Bonus:
Production Discussion

What it was like working on “The Jungle book”

*check out the behind the scenes video to see some of the amazing work from the MPC team including Stephanie.

 

Working on Disney’s “The Jungle Book” was a great opportunity quiet early on in my career. I was lucky enough to work on the show from preproduction to final shot work. The big title of the movie attracted a lot of talent and created excitement within the team and across different departments. Every artist is really ambitious to deliver great and innovative work.

 

The rigging team on the show was amazingly talented and fun to work with. Instead of having one lead we had three leads looking after facial (Nico Sanghrajka), puppet (Andy Phillips) and deformation (James Hood) rigging as well as the character supervisor Ben Jones who had been working in the rigging department for many years himself. They all worked together very well, gave great feedback and kept the team focused.

 

One of the most challenging creatures I worked on was the Pangolin – such an adorable little feller. It was very important that the scales were set up correctly in the rig and not having to be adjusted in techAnim/creatureFX for every shot. In order to do this I am using an inhouse collision deformer on single-sided geometry on each scale and letting the lower plane collide with the ones above it. To create dimension I am pushing out the tip of the scale when the object is compressing. The double-sided geometry is wrapped to each corresponding geometry.

 

Breaking it down in a few steps makes it sound like a simple and straightforward set up but I remember struggling a lot with the skin showing through the scales in certain poses, too much volume being created in certain areas or scales breaking when the limbs were moving far forward.

A few days before the deadline I realized that I had to take a different approach. Instead of having the body drive the scales I needed to let the scales drive the body. I created a very smooth skinning on the entire body and wrapped the covered areas to the scales which works really well.

 

An other character I enjoyed working on and helped me become a better artist was the female white wolf Raksha, who raised Mowgli in the jungle. Working on a hero character is very exciting and it is key to not feel anxious or overwhelmed by the challenge. A hero will have a lot of screen time, close up shots and a wide range of motion. There will be a lot of focus and critique from the supervisors. As a Rigging TD you need to work very closely together with other departments to create something appealing for the big screen.

 

Doing the initial muscleRig was very straight forward, but the finishing touches took a lot more time and effort. Raksha is beautifully groomed so I created shapes to relax and flex her muscles along with wrinkles along the skin as well as skinSliding to bring the fur alive and make her look more believable. I was focused on having her skin feel very smooth and make the bones look very pronounced.

Looking back at my work now I regret not pushing the muscle dynamics and shapes even further to really draw the viewers audience attention onto her. Nowadays I know that it is better to exaggerate and then turn it down more when the first shot renders are done.

Can you talk about the difference between working on a massive VFX film like JungleBook and some of the other types of projects you have worked on?

On smaller projects it is very common to work close together with other departments, especially during the validation phase of the character proportions. Once I recieve a model I lay out a first jointLayout and skeleton geometry to check the overall anatomy and limb length. Afterwards I create a controlRig which I pass on to animation to do some testings and reference line ups.

While animation is working with the first pass of the rig I usually refine the skinning and adjust joint pivots. The skeleton geometry tells me a lot about the current proportions of the character and if it needs to be adjusted by modelling. As I said earlier I like to update the model myself as well and try to create a blendShape of the changes I am proposing or I do a drawing of muscles on top of the model to visualize the adjustments I have in mind. I think it’s important to communicate with modelling and animation a lot during this phase and spot every little issue that might come up in the future.

 

By the time shots pick up there are more and more requests from animation. The animation supervisors usually know what they are looking for. The demands of animation vary from character to character but most of the time their request are minor. Sometimes existing technology needs to be upgraded (a pathRig or extra controls for example) or it can be as simple as showing a different approach to an animator using the current rig. In general I always try to keep in touch with animation and help if there are any issues or requests, such as caching a rig.

 

If later on in the project modelling has to do model updates they usually try to keep the same topology and proportions. Mostly only volume or details gets slightly modified and can easily be updated in the rig. If the proportion are about to change it has to be discussed with animation since updating the joint pivot will affect every shot they have been working on.

In general – and a great part of the job – Riggers deal with many departments on a day to day basis almost towards the end of a movie. It might be a request from lookdev regarding the motion blur of a wheel, or a geometry cache that needs to be done quickly for grooming, a skinFix that can be done quickly in rigging instead of techAnim, and so on. Being hands on is very important but it is also fun to be a big part of the VFX pipeline.

 

 

 

Guest Post : FBX file solutions with Python FBX SDK

FBX, love it or hate it, it has continued to be used and integrated into many game engines and software packages.

We bring you another guest post to help you gain control over and improve the use of FBX in your pipeline.

And now Randall Hess, Principal Technical Animator at Boss Key Productions.

 

 

FBX issues and such

I’ve recently given some scripting assistance, to a technical animator friend of mine at another game studio, that I feel not many folks are familiar with. He was having issues losing attributes or properties when exporting from Motionbuilder to FBX. This is not an uncommon problem with FBX and depending on which version of Maya, 3dsmax or Motionbuilder you are running, the differences with attributes/properties changing or getting completely lost, depending on the object they are associated with, can be very frustrating. I worked with the FBX team many years ago in an attempt to get these and other issues addressed. Some things were resolved but its not ideal to be black boxed by the plugin and its limitations when your pipeline depends on it. This is where the FBX SDK comes in. While Autodesk has not open sourced the fbx plugin, they do continually update the SDK for C++ and Python. With this SDK you can modify the fbx scene file that you are exporting or importing. I was introduced to FBX Python SDK by my friend Jason Parks, many years ago when we worked together at Volition and I have been leveraging its usefulness ever since.

 

Python FBX SDK Uses

Listed below are just a few things that you can modify in an FBX file with the SDK

  • Adding or removing properties/attributes
  • Removing Namespaces before importing or after exporting
  • Removing objects that were not a part of the specifically selected objects but were associated
  • Removing textures or renaming paths
  • Rename objects in fbx scenes without having to re-export the file from the source
  • You can modify most anything in an FBX scene, external from a DCC application

 

Setting up the Python FBX SDK

http://www.autodesk.com/products/fbx/overview
Hit the “Get FBX SDK” link and on the next page look for Python Binding. Choose your flavor, Windows, Linux, or Mac, download and install/extract the package. If you need an earlier version for compatibility reasons go to the “SDK Archive” link. I’m still using 2014.1 and it works fine with Maya 2014/2015/2016 and UnrealEngine 4.x.

You will need to install the package you have chosen to download. This package has a lot of incredibly useful samples for getting started with FBX in python and getting an understanding of the FBX scene in general. If you are at all familiar working with Python in Motionbuilder, pyfbxsdk, it is almost exactly the same and this should be quite easy to pick up.

 

Installing for Maya

If you are working in the latest versions of Maya 2014 and higher you will want the files in lib/Python27_x64 or x86. There are three main files that you will want to point to or add to your existing python paths for Maya.

Here is a snippet to add to a script or your startup for Maya.

import sys
sys.path.append(r'/FBXPath')

These are the files that are needed:
fbx.pyd
FbxCommon.py
fbxsip.pyd

Here is some startup code for the FBX Scene Wrapper Class.

 

import fbx
import FbxCommon

class FBX_Class(object):
 
 def __init__(self, filename):
  """
  FBX Scene Object
  """
  self.filename = filename  
  self.scene = None
  self.sdk_manager = None
  self.sdk_manager, self.scene = FbxCommon.InitializeSdkObjects()
  FbxCommon.LoadScene(self.sdk_manager, self.scene, filename)
  
  self.root_node = self.scene.GetRootNode()
  self.scene_nodes = self.get_scene_nodes()

fbx_scene = FBX_Class(r'c:\my_path\character.fbx') # instantiate the class


The main thing to be aware of with most classes, is that you have to instantiate them to access their internal methods. Here we need to pass an argument that is a string of the fbx file path and name. The _init_ method will automatically parse and load the fbx scene. The one thing when parsing a file that you care about is speed, luckily when working with the Fbx SDK, even in python, I find it to be incredibly fast even on large Fbx files.

Now that the fbx scene is loaded we can go nuts changing the fbx file however we want. At Boss Key, after exporting I run a post process to modify all the fbx files, be it a character skeletal mesh, a weapon, or an animation file. I remove namespaces, empty display layers, remove objects that are in exported hierarchies that I don’t want importing into UE4, or cleaning up any properties when necessary.

import FBX_Scene

def clean_character_scene(fbx_file):
 """
 Clean up character fbx file
 """
 
 # open the fbx scenes and get the scene nodes
 fbx_scene = FBX_Class(fbx_file)
 if not fbx_scene:
  return False

 remove_names = []
 keep_names = []

 # remove invalid nodes noted by properties assigned in the DCC application
 all_nodes = fbx_scene.get_scene_nodes()
 for node in all_nodes:  
  export_property = fbx_scene.get_property(node, 'no_export')
  if export_property:
   property_value = fbx_scene.get_property_value(node, 'no_export')
   if property_value == True:    
    node_name = node.GetName()
    fbx_scene.scene.DisconnectSrcObject(node)     
    remove_names.append(node_name)
   else:
    node_name = node.GetName()
    keep_names.append(node_name)

 # remove the nodes from the scene by name 
 fbx_scene.remove_nodes_by_names(remove_names)

 # remove display layers
 # For some reason these change FbxCollection ID and NodeName
 layer_objs = fbx_scene.get_class_nodes(fbx.FbxCollectionExclusive.ClassId)
 if layer_objs:
  remove_layers(fbx_scene, layer_objs)
  
 # remove FbxContainers
 nodes = fbx_scene.get_class_nodes(fbx.FbxObject.ClassId)
 if nodes in nodes:
   if node.GetClassId().GetName() == 'FbxContainer':   
    # disconnect the layer from the scene
    node.DisconnectAllDstObject()
    node.DisconnectAllSrcObject()
    fbx_scene.scene.RootProperty.DisconnectSrcObject(node)

 # remove display layers
 display_layers = fbx_scene.get_type_objects(u'DisplayLayer') 
 if display_layers:  
  remove_layers(fbx_scene, display_layers)

 # save the modified fbx scene
 fbx_scene.save()
 
 return True

Right after I run my custom fbx export method in Maya I will call a method, such as the one above, all in the same process. So when the artist is finished exporting they won’t even know I opened up the fbx and modified it for the better.

The great thing about the FBX Python SDK is that you don’t need a DCC application to run it. You can run standalone processes and modify all of your mocap or skeletal mesh files, renaming nodes, changing hierarchies or adding properties, all without having to return to the original DCC to reexport. Once you start working with the Fbx Python SDK you may never stop.

The Python SDK can process importing mocap before you actually import it into your scene and remove namespace issues.

 

Once I got familiar enough with FBX SDK I started a project which became the Saints Row Mod Tools. I wrote the tool that converted fbx scenes into the file formats needed for Saints Row 3, and Saints Row IV for for modding purposes. Before we used custom plugins, tools and processes that would be far too complex to release to the community and support for multiple DCCs. Fbx covers all the bases so this was a worthwhile tool and the community seemed to appreciate it.  If you want to download the python script that really digs into breaking down the fbx scene, feel free to hop over to the saintsrowmods forums and grab it.

 

My Public Gists (full examples from this post)
https://gist.github.com/Meatplowz

 

On a side note if you want to actually extend the plugins with C++ you can do so.
FBX SDK Plugin Extension

 

Let me know if you have any questions on the Fbx Python SDK. If you have any suggestions or tips yourself please share them as well.