Wrangle

Wrangle runs your own VEX on the growing tips during the simulation, to write attributes that maps, switches and prunes can read.

Wrangle runs a VEX snippet inside the simulation, on the growing tips, at its place in the growth graph. It is for what the built-in nodes don't cover: an age of your own that counts during growth, a flag a Switch can test. The usual job is to write an attribute and let Maps, Switches and Prunes read it. VEX in Natsura has the wider picture.

Inputs

The input labels say what each one is in VEX:

  • The first input is the growth graph. It isn't readable in VEX; input 0 in your snippet is the branch tip being grown.
  • The second is reserved: input 1 in VEX is the full skeleton grown so far, for queries such as nearpoints().
  • The third and fourth take ordinary Houdini geometry, which VEX reads as inputs 2 and 3.

The Graph output goes wherever a Grow's output would. The Wrangle tool on the Natsura toolbar (under Advanced) places one at the cursor.

Parameters

The snippet goes in VEXpression. The Wrangle writes back every attribute the snippet sets. Output Attributes only decides which of them are offered in the attribute menus of maps, switches and other nodes downstream; the default, * ^N ^up ^P, offers everything except N, up and P.

Mappings adds named values the snippet can use, each set by a number or by a Map (MAP1, MAP2 and so on, unless you rename the binding).

Attributes you can read

Natsura writes these on every point of the skeleton. Most of them change as the tree grows, so a snippet, a Switch or a map on a Grow can read them on the growing tips. A few only mean something on the finished tree, after the Simulate, where decorations and their traits read them.

During growth and on the finished tree:

  • u runs from 0 to 1 along a chain, and reaches 1 only when the chain is fully grown.
  • u_normalized reaches 1 at the tip of a partly grown chain.
  • height is a point's world Y position, so it is measured from Y = 0, not from terrain or the source point.
  • distance_to_root is the distance along the tree back to the root.
  • actual_length is the internode length, from the previous point to this one.
  • internode_id numbers the branches one Grow makes at a node, from 0, and internode_count is how many there are.
  • split_index numbers the branches of a Split, and split_depth counts the splits a branch has passed through (those with Increase Depth on).
  • random is a stable random number given to each point when it is created.
  • generation is the step a point was created on. On the growing tips it is the current step, so it is the same for every shoot growing at that step.
  • P, N and up are the position and the local frame.

With an environment wired into the Simulate's Geometry input:

  • ao is how open a point is to the environment, and is 1 everywhere without one. ao_environment is the part of it that comes from the environment.
  • thigmotropism_distance (Surface Distance) is the distance to the nearest surface.
  • phototropism_direction (Photo Direction) points towards the light and thigmotropism_direction (Thigmo Direction) towards the nearest surface. They steer growth only where a Grow uses them in an effector row.

On the finished tree:

  • age counts the steps since a point was created, so the oldest wood has the highest values. On a growing tip it is always 0 or 1. During growth, use distance_to_root, height or u to tell lower, older parts from new ones, or an attribute on the source points for the age of a whole tree.
  • elevation_angle is the angle of a branch from horizontal in degrees, +90 straight up. It is a good trait for choosing parts on a decoration.

Attributes on the Simulate's source points keep their names and are carried into everything grown from that point, so they can be read the same way; see Attributes. Custom attributes you write in a Wrangle can be read the same way downstream.

Runs on the growing tips

The snippet runs inside the simulation on the growing tips, not on finished geometry. To work on the finished tree, use an ordinary Houdini wrangle after the Simulate.