Running the Existing Graph¶
Before we can do anything with OmniGraph, we must make sure the appropriate extensions have been loaded. Please open the extension manager:
Make sure at least the following extensions are loaded. It’s a good idea to turn on auto-load for these as well, so we’ll only need to do it once:
This is the omni.graph.bundle.action extension - an all-in-one extension that loads a lot of the necessary extensions:
This is the omni.graph.examples.python extension, containing some of the Python nodes that we’ll be working with:
Note in particular the folder icon. The sample files for this tutorial can be found by clicking on the folder icon.
To start things off lets run an existing graph already assembled. Please open the deforming_text_tutorial_finished.usda file in the omni.graph.examples.python/data folder.
Select the green ball (Sphere in the stage view) and move it:
As you do so, you should see the text change color and move, and the plane underneath the text should deform:
Let’s take a look at how this is working. Bring up the generic OmniGraph Editor like so:
To open an existing graph, select Edit Graph, and then select /World/PushGraph:
You can navigate the graph by panning using the MMB, and zooming using the mouse wheel. Zoom out to see the full graph:
That looks a little complicated. But fear not, it’s not that complicated at all. Let’s zoom in to the left part of the graph.
Let’s take a look at the connections from this first Read Prim Attribute node. There are essentially two branches of connections - a whole bunch that goes up, and one that goes down. Let’s take a look the connects that go up first.
If you follow the topmost connection, it’ll go to a node that looks like this:
It’s a node that takes the position information and converts it to color. This is in turn driving the display color of the text.
Let’s now take a look at the connection in the other direction:
We can immediately see that the first node takes the position information, which is a tuple of 3 floats and breaks it up into its constituent parts. The next node takes the absolute value of the X coordinate, because we want the effect to be symmetrical around y-z plane.
Following the connection further, we see several further nodes:
The basic idea is this: we subtract the positional X value from a fixed value, so that as we move the ball towards the center, the resultant value goes up, as we want our text to be lifted. The value is then clamped to a lower bound so that the text doesn’t sink below 0 as we drag the sphere far away from the origin. This clamped value is then multiplied by a different amount depending on which letter it is, and the final results is then composed again into a tuple to drive the position on one of the letters.
This concludes the first part of the tutorial. Next, let’s see how you can create your own graphs with existing nodes.