Category Archives: Tutorials

Matt Chandlers Talk on ‘The Swarm’

Matt Chandler recently was invited to talk about the project that I worked on earlier this year ‘The Swarm’ for Thorpe Park. Watch it below for some behind the scenes work etc.!

Quoted from Matt:

Due to a number of requests – this is a condensed version of the talk i did this year at the End user event in Utrecht, Netherlands about the commercial my studio recently made for ‘The Swarm’.
I recorded some audio live whilst doing the lecture – but unfortunately it wasn’t useable – so i have re-recorded some voice over – similar to the live talk.

Many thanks to all who attended the talk, the Q& A and the big applause at the end 🙂
It was a pleasure to attend EUE and i hope to attend again next year with more stuff to talk about.”

Softimage XSI Custom Menu

The easiest way to access your own, or third party scripts from the UI in Softimage XSI is creating a toolbar. With these you can simple drag & drop text from the script editor onto your own toolbar, then save that in your user or workgroup folders.
That is fine, but they don’t really have place to dock them to the layout.

Instead of that, my much preferred way is to create your own custom menu in the menu bar.

I recall not really finding much information of how to make these custom menus for XSI, the help file has never really provided much information, but the best way to start usually would be to make a custom property from the wizard.
Animate > Create > Parameter > Custom Property Wizard

This isn’t specifically for making a menu, but it creates a plugin script that you can then open and it may help you understand some of the concepts associated with a plugin.

(as it says in the old/not amazingly useful wiki here: http://softimage.wiki.softimage.com/index.php/Custom_Menus).

So to save you all that trouble, here is a basic custom menu template that you can easily use and adopt for your own menus.

The following code should be saved as a Python file (.py) in the Application/Data/Plugins directory.
I would always recommend creating your own workgroup which is software version independent, and others can connect to (potentially very useful for a custom menu where you might be sharing studio tools on a server)

You will see I have saved the version on the script file which aligns with the versioning in the script:

If you use these, XSI will always load the latest version.

I have commented in the example script where you should insert your own code – but if you use as is, it should display the example menu correctly.

I’m sure I had some good help/spying at their menus from Juan Brockhaus (nice website link I found here for him), Andy Nicholas and Peter Agg over the last couple of years in this area to thanks to them!

If you have any comments then ask below!

Python Scripting in Softimage XSI: Selection

I was originally planning to post purely about the incredibly useful simple task of making a loop to do repetitive tasks for you. You don’t need to be a TD for this to make things easier day to day, modelling, texturing, lighting, scene organising etc. You could use this in any situation.
ANYWAY as I wrote it I realised I was getting deep into some fundamentals whilst I was explaining how to access the object selection. So For this post I’ll just stick to selection and then advance that in the loop later.

    • Using this command, you can access the objects that are currently selected:

      This is a collection, so if you were to ‘print’ that command, you wouldn’t get great feedback about what it contains.
      In the following code examples, the lines that begin with # hashes show the results of the previous line of code when they are run.

      Note: if you ‘comment’ out a line in a script with the # it will be ignored when run – thus you can use it for commenting your code)

      See! Not so helpful. But as a collection, you can iterate through it using a ‘for loop’. Good old loop.

      Here there are a couple of important things to note in the loop.
      The indent is used by python instead of {} or things like that in other code. So after the loop begins, the next line that is INSIDE that loop, is in the indent, when lines stop being indented, the loop is over – it should be clear to read.
      “oObject” is a variable being declared at this point to be used in the loop. So you can name this whatever you like it is not in relation to anything previously (this is something that confused me to begin with so I’ll try and make that clear)
      I prefix the variables with ‘o’ to make it clear what they are, I picked this up from somewhere..

      So that’s the way to access each object in a loop. I’ll write up why that’s useful in the next post about loops specifically.

    • If you want to specifically pick the first, last, or any other object by index you can do that too.
      Note here I will create variables and then print whatever they contain, instead of printing the full command, this is a main principle while scripting, for tidiness, clarity of reading, organising, swapping data in and out.. And other great mysterious reasons I don’t understand.

      So that’s getting the first object (or ONLY object if there’s only one selected)
      Arrays/indices always start from 0 in scripting, so the FIRST index is always 0. Keeping that in mind, how to get the last object…

      To do that you need to get the length of the selection – the number of objects selected.
      For instance if you have 4 selected, the indices would be 0,1,2,3. So after getting the length (4) you need to subtract 1 to get the last index in the list. To get the length, use this command:

      Then you can use it like so, subtracting 1:

I guess that is about that for accessing the selection! I’ll write about what to do with the selection with loop later.

Nuke Custom Scripts Folder

Keeping custom stuff (scripts/menus/gizmos etc.) outside of an application’s own folder and into a custom folder such as on a server is useful for keeping your things organised, and potentially VERY importaly sharing between more than one user in a work environment.

Also I find it’s useful for backing up, instead of having to go and find lots of different application folders you need to keep, you can keep them all on the server.
I’ll probably use the ‘Workgroup’ quite often as that’s what it’s called in XSI, which is set up really well for this kind of business.

So for Nuke there is a ‘init.py’ file that you can add paths to that nuke will check for scripts.
I’m not going to go into any great detail what it is for, but just what is needed to achieve the point of the post.

In windows, it’s in a folder like this (depending on Nuke version)

Instead of adding to that file, you can create your own blank ‘init.py’ script in your user folder, this is much cleaner and is independent of Nuke versions.
You should create the file in a path similar to this:

Inside the file, all you need to do is add one line, telling Nuke where to pick up the scripts. Be careful to use ‘/’ instead of window’s ‘\’ which causes potential conflicts:

In my Nuke workgroup folder I have a few scripts which I’ll detail in a differnet post.
Namely there is:

  • menu.py – A custom menu in the menu bar.
  • sr_Scripts.py – Contains my custom scripts which the menu references

Bike Chain in ICE

[vimeo clip_id=27777795]
Here is a quick video of a bike chain I’ve put together in ICE within XSI using a node I had previously created to distributed points along a curve.

Perhaps more crucially distributing points on a curve evenly can be trouble because of the curve itself. But I have managed to work out a method that should help.. I’ll post more on this shortly.

3d Compositing Guide (Part 02)

This is the 2nd part of this guide, more ‘how’ than ‘what’ from the first part.

I’ve just realised how long ago it was now when I wrote the first part nearly 6 months, time flies these days :). Check the first part about the different passes you may want to use and why, here.
Compositors
There are a few major compositors, Shake, Combustion, After Effects, Nuke, Fusion and XSI’s FxTree.

The most commonly used and standard is probably Shake (although it has now been discontinued by Apple) and as with the 3d side of things, probably even more so, the principles are the same.

Personally my preference is to use the FxTree within XSI. The similarities between FxTree and Shake are a good example of the lack of contrast between compositing apps, including similar nodes layout and workflow. They are what I have most knowledge in, so I will use them as the main apps in this guide.

Instead of using layers like you would in Photoshop (or Combustion/After Effects in fact), Shake and FxTree for instance are node-based so every effect/filter/operator is a node inside a ‘tree’ which can contain one or many in or outputs. Having this tree, you can always go back and adjust settings in any node as it will not have been applied permanently, frozen or collapsed, and thus non-destructive.

The Tree

Now here is my compositing tree in FxTree, as well a comparison tree in Shake and Fusion, just to show you how much or little they differ.
The nodes are very similar in the different apps, Shake and FxTree are nearly identical and have a few key features. They both have an edit button to bring up the properties of a node and a view button so you can view the tree up until that point.
The small lumps around the nodes are where you plug in other nodes. These vary from node to node, for instance ‘Input’ nodes don’t require an input, like ‘Output’ nodes don’t require an output. And some nodes can have multiple inputs for different reasons.
On the FxTree, the green ones along the top are the inputs, the blue on the site are for mattes, and the red at the bottom is for the output.

FxTree:
Essential Nodes

Now straight into those all important nodes. I’m going to use stuff from the first part of the guide so make sure you’ve read that too.

  • Input/Output Nodes
  • At all the tips of all the branches in the tree, there needs to be some kind of input node. Often it may be an image, a render/pass or a background plate perhaps. But it could also be a plain colour, a gradient or a rotoscope/mask of some kind also.

    I’ve highlighted these on the tree in red:

    Also worth mentioning here are Output nodes, this would be at the very base of the tree as the final output for the comp to output to whatever format you want.

    So we have are inputs, but how to we stick them together I hear you ask! Well, more nodes……

  • Math/Layer Nodes
  • Here on the tree, they are highlighted in yellow:

    – ‘Over’

    In a layer based app like photoshop, you would place the beauty pass with its transparency ontop of the background plate it will lay over the background nicely.
    Well the equivalent to that would be the aptly named ‘Over’ node – Which has two inputs, one for the background element (the left side of the tree in the image), and the other foreground element (the right side). If the foreground element contains an alpha channel (RGBA) it will use that as its transparency (by pre-multiplying, which can be tricky to get your head around so we won’t go into that for now).

    – ‘Add’
    In FxTree all the math nodes are selectable in one node named ‘Math Composite’ which you can see in the image. The node that “Spec_Signs_” is plugged into is set to add.
    The first of the math nodes does literally what it says, it adds the pixel values of the two inputs together. We would usually use this to add reflections and specular passes to the comp.
    These passes are mostly black apart from the bright highlights/reflections. Adding, effectivly removes the black but doesn’t just lay the rest of the image over the background (like an over with an alpha channel) it brightens it.

    So if we pick a random pixel on the background image, it will have 3 values from 0-255 for each colour channel (Red, Green and Blue). But for now we will just assume they are the same in each channel, so one value from 0-255 where 0 is black and 255 is white.

    Now this is why the black pixels are effectivly removed with an add node, as any pixel value + 0 (black) will remain the original value. But any value greater than 0 will brighten the background pixels:

    bg + fg = output
    50 + 0 = 50 (no difference)
    128 + 205= 255 (as colours will be clamped at 255, pure white)
    190 + 55 = 245 (brighter)

    Hopefully that didn’t sound too complicated, but its also the base for the other math nodes so it should have got a lot covered.

    – ‘Multiply’
    The Multiply in the tree above is the ‘Math Composite’ which the ‘AO_’ is plugged into.
    Kind of the opposite to add, using Multiply removes the white from an image. Now for multiply I’ve found it best to consider the pixel values normalised, so the proper range of 0-255 is now 0.0 to 1.0
    So when multiplying a Ambient Occlusion pass for instance, we want to remove all the white and keep the darker areas.
    Remember, black = 0.0 (0), white = 1.0 (255)

    bg x fg = output
    50 x 0.0 (0) = 0 (black)
    128 x 1.0 (255)= 128 (no difference)
    190 x 0.22 (55) = 41 (darker)

    So multiplying white pixels has no effect, but for anything less than 1, it darkens the pixels.

    – Other Math Nodes
    Multiply, Add and Over are the main layering nodes that you’ll need to use, while there are other common nodes, including ‘Screen’, ‘Subtract’ etc. I won’t go into these, have a play for yourself if you want to see what they do 😉

    • (Slightly) Channel re-ordering

    These mostly concern extracting/switching mattes and alpha channels from different passes and colour correcting.

    These can be found under some quite different names, and with different choices in the different apps. For instance, FxTree gives us a few nodes that with different levels of complexity:

  • ‘Swap Component’
  • ‘Component Parser’
  • ‘Pixel Parser’
  • Personally I tend to use the ‘Component Parser’. A little more advanced than Swap Component as it gives you the chance to write a simple expression, and also multiple inputs so you can pick channels from more than one source.

    You can use these nodes to change the alpha to a solid colour, effectively removing it. By setting the alpha to 1 (black) or 0 (white) – which is handy if you’re adding a pass (reflection pass for instance) but don’t want to add its alpha channel as well – which could cause those evil nasty black edges.

    Often a you may have an image/pass that doesn’t have the alpha channel you want, so you can replace the original using another image.
    As well as alpha replacement, you can replace the alpha with the values from another channel (eg. green). And from the first part of the guide, this is why I have rendered an ID Pass.

    First of all we plug the ID pass (input node) into the component parser. In the component parser settings, we decide what channel we want to use, red for now, so we type ‘r’ into the alpha’s input area. It doesn’t matter what we type for the R, G + B channels because all we’re going to use is the new alpha.
    Now we can plug this into the matte input of some other node, a colour correct for the beauty pass for instance – so we can colour correct a specific part of the render.

    Copy and paste those nodes a couple of times and change the alpha inputs from ‘r’ to ‘g’ and ‘b’ respectively to use those mattes also.

    In the image above, you can see the nodes in action:

  • The beauty pass on the top left in its original state.
  • The ID Pass on the top right, again in its original state.
  • Below that, the ID pass’s red channel has been extracted and set to be used in all the channels, but importantly, the alpha.
  • This plugs into the colour correct’s matte input, so that only the frame of the triangle sign is affected, and turned a lovely green colour, a fine improvment.
  • Thats about all for now, might add a little bit so feedback at this point would be welcome.

    Bit Depths
    I was also planning on writing a wee bit about bit depth, but through rather very little research I found a couple of really great, clear sources and explainations.
    Though I’d like to quickly mention that often these 2 links refer to 24bit (16 million colours) which is 8 bits per channel, and thats how it is usually reffered to in 3d software. ie When you save a png it will ask if you want to save in 8bit, or 16bit, not 24bit and 32.

  • Cambridge In Colour
  • Wikipedia – Bit Depth
  • Other Resources
    Books:

  • The Art and Science of Digital Compositing – The holy grail book!
  • Web:

  • Andrew Whitehurst – Matching Real Lighting
  • Jostein Finnekåsa – Compositing Tutorial
  • Compositing Forum on Cgtalk
  • 3d Compositing Guide (Part 01)

    Update September 2009:
    This is a wee bit old now. So personanly my workflow has probably changed a bit, but in general hopefully this is still a useful guide 🙂 (also this page my be a little messy, mostly copy+paste from the old blog)

    Before I start I should say that this is based on what I know and learnt from people at uni, and at work, and the internet.
    Other people you may learn from prefer more or less passes etc. for more control or to save on excess files – so just keep in mind there are usually different ways to do things all with their own advantages and disadvantages (and don’t blame me).

    In this tutorial I’ll be using examples from a couple of shots from our short film ‘Diversion’. Directed by myself and Aidan Gibbons

    Types of Passes

    If you want very fine control in post over every element of the scene, you could render the the objects in tons of passes with a different one for every element in the render, ambient texture, different light passes, shadows, reflection, refraction, GI the list goes on.but generally thats not really necessary.

    So if you like you may want to include lighting/shadows/specular/GI all in this one pass and maybe just add a couple of additional passes to this ‘Beauty’ pass.

    For compositing with live action in ‘Diversion’, we generally used a standard set of passes on all shots, and then on some shots we needed some other specific passes to help out with mattes, masks and the like – which I’ll try and mention a couple of later.

    So here is an example from excitingly named ‘Shot14’.
    First of all, here is the background plate from the footage:



    Don’t think there’s much to explain on that one.

    Beauty (RGBA could be named ‘Diffuse’ or ‘RGB’ perhaps)

    This is the base for the cg elements in the shot, and it can vary a lot what is included in this pass.
    Our standard beauty pass included shadows cast onto the objects but not shadows cast onto the plate (separate pass for them) but as there isn’t any shadows in this shot, I won’t go into why now.
    When we light the diffuse pass, I find it helps to make it a bit brighter than you want in the final shot, especially to take into account the ‘Ambiant Occlusion’ (or ‘Dirtmap’) pass which adds the darker areas in this shot.

    Specular Pass (RGB, Alpha channel not needed)

    This pass is for specular only, and is layered over the top of the beauty pass with ‘screen’ (or you could ‘add’ (additive) it). Screen or Add basically remove all the black in the pass, leaving just the highlights (the specular in fact.)
    This is the same for a Reflection pass, and if you want to render a light in a separate pass – as again you just want to hide all the black pixels values and keep the white values.

    Reflection Pass (RGB, Alpha channel not needed)

    Whoops, I seem to have got a little ahead of myself there. Anyway this reflection pass, is on the plate, so instead of compositing it onto the last two passes, we can lay it straight onto the plate. Smashing.

    Reflection Matte Pass (RGB, Alpha channel not needed)

    Now you can’t just slap the reflection onto the plate in this instance, because there are already reflections on the floor that would be occluded by the signs were actually there (they would block them).
    So I found a good way to create a matte for where the reflections will be is to make a pass where the signs materials to a constant white material, and have that as the only thing reflecting in the scene.
    N.B This needs to be inverted in post truthfully in the film I made the objects black, and rendered them on a white surface and a white environment – but now I realise that is way to overcomplicated as you can just invert it.

    You can multiply this pass onto the plate before the main reflections to matte out those reflections you don’t want.



    Another note about the reflections I’m afraid. If you look at the plate, you can see the differences between the soaked floor, and the standing water/puddles, the puddles are sharp reflections while where the water has soaked in, the reflections are blurred.
    So before those passes are rendered I painted a matte based on the plate – and used a camera projection to apply that texture onto the floor, to control the amount of blur for the reflection.
    Hopefully that made sense.

    Ambient Occlusion (RGB, Alpha channel not needed)

    This pass effects the CG elements as well as the plate (although often you may want to render 2 separate AO Passes), so to layer it onto both, before this we need to layer the CG passes we have so far, over the plate (including the reflections).
    For this pass, we just want to keep the darker values, so to remove/hide the white, we will use ‘Multiply’.

    ID Pass (RGBA)



    This should come earlier in the comp, I mainly use it to colour correct the diffuse pass before anything else is layered on top (so maybe earlier in this guide? But its a bit special so I thought I’d leave it till now). This is a very useful pass for making multiple matte’s (masks) in one pass.

    By giving certain objects materials that are either, 100% Red, 100% Blue or 100% Green we can extract just one of these channels (R, G, or B) in post as a matte to do colour correction on specific objects or whatever you please. As you can see by this gif below, which cycles through the RGB, then Red, then Green, then Blue channels.

    If you’re feeling fancy you can use the A channel too, currently the A channel will show the objects that are in the R,G,B channels (as they have an alpha of 1 / 100%), but if you assign everything else a black material with an alpha of 1, you could specifically assign some objects with a black material with alpha 0.
    Hope that made sense, don’t have any images for that at the moment. 🙂

    Here is the final Graded shot:

    If you want to watch the shot, and indeed the film, here it is:

    Diversion (2005) from Simon Reeves on Vimeo.

    Hopefully I will write another part to this if its useful about the actually comping process, Multiplying/Adding/Over using ID mattes and so on.
    I personally use the FxTree within XSI but Shake/Nuke/Combustion are all the same principles so it shouldn’t be a problem.

    If you see any mistakes or have any comments please email me or use the comments thing on here – Cheers.