Difference between revisions of "Importing Animation Data from .chan/.mov Files"

From Planetside Software Wiki
Jump to: navigation, search
Line 83: Line 83:
 
chan files are are a simple text format. Essentially they consist of multiple numeric values per line, with each value separated by a space. How the values are interpreted on import depends a bit on how the file is imported. chan files are easy to generate if you want to create animation data from a script or spreadsheet or similar.
 
chan files are are a simple text format. Essentially they consist of multiple numeric values per line, with each value separated by a space. How the values are interpreted on import depends a bit on how the file is imported. chan files are easy to generate if you want to create animation data from a script or spreadsheet or similar.
  
If you want to generate chan files for use with TG2 the preferred format is the 8 channel Nuke .chan variant. In this format there are 8 values per line, ordered like this:
+
If you want to generate chan files for use with the TG2 Camera node the preferred format is the 8 channel Nuke .chan variant. In this format there are 8 values per line, ordered like this:
  
 
<ol>
 
<ol>
Line 106: Line 106:
  
 
Each value is separated by a space.
 
Each value is separated by a space.
 +
 +
If you are generating chan files for animation objects etc. using the '''Import chan file''' button then there must be 7 values per line. These are the same as the first 7 values above.
  
 
Please note that the data is expected to be in the Houdini coordinate system and is converted to the TG2 coordinate system on import. See the '''Coordinate spaces''' section above for more information about that.
 
Please note that the data is expected to be in the Houdini coordinate system and is converted to the TG2 coordinate system on import. See the '''Coordinate spaces''' section above for more information about that.

Revision as of 09:29, 17 May 2012

Terragen 2 can import motion and camera data from .chan and .mov files. .chan files can be exported from Houdini and Nuke and Maya can export .mov files. There are also often plugins or scripts available for other applications which can export .chan files. "chan" will be used to refer to both .chan and .mov files in the rest of this document.

TG2's preferred format for chan files is the 8 channel Nuke .chan format. This is the format that works best with default import settings. For more information about that format please see the Writing chan files section below.

Importing from animation buttons[edit]

Before discussing chan files it's worth mentioning importing animation data from files using parameter animation buttons. Animation buttons have an Import animation file... item in their menu. This can be used to import animation data from simple text files similar to chan files but an important point is that the values read from the file should be in TG2 coordinate space and not Houdini coordinate space as for chan files.

The file format is similar though. From 2 to 4 values are read from each line of the file, depending on the parameter type. The first value should be the frame number. The values should be separated by spaces.

Importing chan files[edit]

There are several ways to import data from chan files.

Camera nodes
Camera nodes have the most configurable chan import options. The Import tab allows you to import chan files and you can choose to import position and rotation data as well as camera view data.

The camera node has some rules about how it interprets chan files:


If the file has a .chan extension then

  • the file should have 7, 8 or 10 values per line.
  • if the file has 7 values per line it is assumed to be a chan file without a frame number. In this case the number of the line in the file is used as the frame number. The first 6 values are position and rotation data. The 7th value is vertical field-of-view.

  • if the file has 8 values per line the first value is a frame number. The next 6 values are position and rotation data. The 8th value is vertical field-of-view.

  • if the file has 10 values per line the first value is a frame number. The next 6 values are position and rotation data. Value 8 is focal length, value 9 is aspect ratio and value 10 is horizontal aperture.


If the file has a .mov extension then

  • the file should have 6 or 7 values per line.
  • the number of the line in the file is used as the frame number.

  • the first 6 values are position and rotation data. If there are 7 values the 7th is vertical field-of-view.


The Camera node has several options for importing camera view data. They effect how the view data is interpreted:

  • Import vertical FOV: If this is checked the 7th or 8th value in each line, depending on the the file format, is read as the vertical field-of-view.
  • Import focal length: If this is checked the file must have 10 values per line. Value 8 is read as focal length, value 9 as aspect ratio and value 10 as horizontal aperture.

  • Import focal length to FOV: If this is checked the values are read as per Import focal length but the field-of-view parameters are also animated.

  • Do not import FOV: Field-of-view data isn't read from the file.

For more information about importing chan files using the Camera node please read the Import tab documentation.

Other nodes
A number of nodes have an Import chan file button. For example the TGO Reader node has an Import chan file button on its Transform tab. This button loads a chan file and uses the file data to animate position and rotation parameters. Which parameters those are depends on the node. As an example with the TGO Reader the Translate parameter is animated but for the Lake node the Centre parameter is loaded. Some nodes might not have a rotation parameter to animate, and in that case only the position is animated.

The first value read from each line is the frame number. The next 3 values used to set position and the next 3 are used to set rotation. There must be 7 values per line.

Coordinate spaces[edit]

In the case of motion data imported from object Import chan file buttons and the Camera chan import it's assumed the data is in Houdini coordinate space. It gets converted to TG2 coordinate space on import. Here's how the Houdini coordinate space compares to TG2:

  • X (same as TG2)
  • Y (up, same as TG2)
  • Z (out of screen, negative/opposite to TG2)
  • Rotate X (pitch upwards, same as TG2)
  • Rotate Y (anti-clockwise* heading, negative/opposite to TG2)
  • Rotate Z (bank left, negative/opposite to TG2)

* Heading is anti-clockwise when viewed as a heading on a map, but it's actually clockwise when viewed along the the positive Y axis.

Writing chan files[edit]

chan files are are a simple text format. Essentially they consist of multiple numeric values per line, with each value separated by a space. How the values are interpreted on import depends a bit on how the file is imported. chan files are easy to generate if you want to create animation data from a script or spreadsheet or similar.

If you want to generate chan files for use with the TG2 Camera node the preferred format is the 8 channel Nuke .chan variant. In this format there are 8 values per line, ordered like this:

  1. Frame number
  2. X

  3. Y

  4. Z

  5. Rotate X

  6. Rotate Y

  7. Rotate Z

  8. Vertical field-of-view

Each value is separated by a space.

If you are generating chan files for animation objects etc. using the Import chan file button then there must be 7 values per line. These are the same as the first 7 values above.

Please note that the data is expected to be in the Houdini coordinate system and is converted to the TG2 coordinate system on import. See the Coordinate spaces section above for more information about that.


Back to the Animation Module Reference

A parameter is an individual setting in a node parameter view which controls some aspect of the node.

A single object or device in the node network which generates or modifies data and may accept input data or create output data or both, depending on its function. Nodes usually have their own settings which control the data they create or how they modify data passing through them. Nodes are connected together in a network to perform work in a network-based user interface. In Terragen 2 nodes are connected together to describe a scene.