In|Framezฎ Papers

The XSI FX

By Homam Bahnassi


It is one of the new toys that XSI2 offers for us to play with, allowing us to accomplish most of the compositing tasks we need.
In this tutorial I'll demonstrate how to use this great feature and how to take benefit of its integration in such a powerful 3D animation package.
We’ll build a simple FX Tree and animate some of it’s parameters to achieve a simple, yet interesting effect: The scene includes a magnifier, and a shaded 3D chair. The magnifier moves over the chair. Wherever the chair shows under the magnifier, it shows as a wire-frame 3D chair instead of the original shaded one. Right now, all the resources are static 2D rendered pictures.
(Download files used to complete the tutorial [151,228 bytes]).

The Final Result

Through out this tutorial, we'll run across the following key points:


Skill Requirements

Fundamentals of using XSI FX.
Basic knowledge of animation techniques in XSI, especially expressions.



Tree Seeding...

Let's begin by modifying the interface for our compositing work. It's up to you to manage the interface the way you feel most comfortable with, but consider to stick the FX Viewer & the FX Tree in your new custom interface for easy access.
When you're ready, add your first node in the FX Tree which is (of course) a ‘File Input’ node (Operators>Image>File Input). Double click on it to open its PPG. For the ‘File Name’ field, browse the “pictures” folder in the ComposingTut database and choose the “magnifier_cut.pic” picture file.

Adding a ‘File Input’ node

Examine the alpha channel of the picture in the FX Viewer by pressing the alpha display button under the view area.

Displaying an image's alpha channel

Add more two input nodes and choose “chair_wire.pic” and “chair_shd.pic” as the Input File Names. Now we will use the ‘Over’ node to composite the chair shaded picture over the wire picture, so get an ‘Over’ node either from the operators menu in the FX Tree or from the FX Operator Selector (Operators>Composite>Over) and plug the “chair_wire” node in the background input and “chair_shd” node in the foreground input.

Getting an ‘over’ node

Next we need to drive the ‘Over’ compositing node by the alpha channel from the “magnifier_cut” picture source, so plug the “magnifier_alpha” node in the ‘obey matte’ plug of the ‘Over’ node. Move your mouse over the ‘Over’ node then click the The V Icon icon, you will notice that Fx Viewer will show a cropped area in “chair_wire” that reveals “chair_shd”.

The chair's shaded image, cropped by an alpha

Save your work.


The Magnifier Pass

We'll use another ‘File Input’ node to get a new picture of the magnifier with another alpha channel “magnifier_object.pic”. This picture will be used for adding the magnifier picture on top of our pictures. To do that we need another ‘Over’ node that combines the result of the previous ‘Over’ node with the new “magnifier_object” input node. Get one & do the connections.
This time we need to change ‘Over1’s ‘Foreground Type’ parameter to “Not Pre-multiplied” in order to use the alpha channel in the image source as a composite mask.

Detective XSI! Applying the magnifier's image to solve the Mystry of Wire-Frame!

Save your work again...


Expanding The Tree

Now that the concept of our compositing is ready, we can expand the FX Tree (for animation purposes) by adding the ‘Transform3D’ node to control the movement of our magnifier. Get two ‘Transform3D’ nodes and connect each one of them directly between the magnifier ‘File Input’ nodes and the ‘Over’ node (Operators>Effects>Transform 3D).

Adding more control: the ‘Transform3D’ nodes

Open the ‘Transform3D’ PPG that is connected to the “magnifier_object” and start playing with the “Move” and “Scale” parameters and watch how the magnifier moves and scales in your FX Viewer. Of course you need to set the same values for the other ‘Transform3D’ node or you'll get an offset between the magnifier object and the cropped view.


Animating Stuff

Animating the transformations of the magnifier for this compositing could be a time killer, especially that you need to set two keys a time for each ‘Transform3D’ node. So we’ll take benefit of integrating the compositor in XSI and manage the animation using some of the powerful animation tools that XSI offers.

We'll use some simple technical directing to simplify the animation process. Get a dummy object, for instance implicit torus (which will represent the magnifier object in the animation process), set its “Radius” to 2 units and its “Cross Section Radius” to 0.1, rotate it 90 degrees around the X-axis.
Add also a square primitive and scale it to 1.333 along the X-Axis and move it to X=-1, Y=-1.75 to define the working area or the boundaries of your scene.

Mimicking FX View in OpenGL's viewports

Now open the PPG of one of the ‘Transform3D’ nodes. Right click on the green chip besides the “Move” and choose ‘Set Expression...’. When the expression editor pops-up, add an expression that links the local positioning of the torus to the “Move” parameters. This could be done by clicking on the ‘Object’ button on top of the Expression Editor and navigating through the torus operator tree until reaching the local positioning parameters (torus>kine>local>pos>posx).

The missing 'link' that solves this case

Copy this expression to all other axes and to the other ‘Transform3D’ node, and don’t forget to modify them respectively.
Now, try moving the torus around and watch how the magnifier moves in the FX Viewer. Mostly, the expressions need to be multiplied be a number in order to match the torus with the magnifier in the viewer. In my case I multiplied all transformations by 40 which worked fine. If you've used values other than what I used in this tutorial, then you'll need to do a little calibration for the expressions.
Repeat the same thing for the “Scale” parameters in the “Transform3D” node and link it to the torus scale or radius.
As usual, save your work.

Note: Some times XSI will refuse to set an expression for a compositing node’s parameter; one available workaround is by selecting ‘Animation Editor...’ then changing the viewing area in the animation editor to Expression Editor.

Finally, you can begin animating the torus the way you like and interactively in the OpenGL viewports while watching your animation’s results applied directly on the magnifier in the FX Viewer.