Instancing lines given start and end points; my learnings

As part of implementing a mystic rose ( Complete graph - Wikipedia ) in TouchDesigner, I needed to instance lines between given start and end points. The calculation of the points themselves was fairly straightforward, but I ran into a few issues when trying to draw lines between them using instancing.

Below are the key issues I fixed to make this work (patch attached). I’ve noted my current understanding (newly learned) of why these changes helped. Take it with a pinch of salt — all feedback is welcome. Thanks.

  1. Set Rotate to OP in Instance 2 to the calculated direction
    This is the most obvious step. It tells TouchDesigner which way each line must point.

  2. Set Anchor V(Y axis) of the primitive used to connect points to 0 (instead of 0.5)
    This ensures that the line is anchored at the base and grows in the one direction. Leaving it at default value (0.5) causes the line to grow equally in both directions from the center.

  3. Set Rotate Up OP in Instance 2 to (0, 0, 1)
    This tells Touch which direction is ‘up’. Without this, Touch may choose different orientations for similar or opposite connections, causing some lines to twist or point incorrectly.

  4. Set Rotate to Vector: Order to “Rotate, then Rotate to Vector”
    This prevents TouchDesigner from mixing different rotation operations, which can cause lines to be oriented incorrectly or miss their target points.

Note:
I am drawing the line along the Y axis. This means:

  • The Y size of the primitive is set to 1 (this will be scaled based on the length calculated in the GLSL).
  • The Anchor V of the primitive is set to 0.
  • The Forward Direction (under Instance 2 of the Geo COMP) is set to +Y.

mystic_rose-forum.toe (9.9 KB)