chan file help needed asap! for movie title sequence

Started by tomatomic, April 24, 2007, 02:20:28 pm

Previous topic - Next topic


hi all,

hate to spam the fact i'm working on a title sequence for an upcoming film, but.. i am.
the deadline is tight, of course, and need a solution quickly. me and the company im working with (framework, in LA) love the look of t2 output so much, we are trying this "experimental" approach to achieve a segment of our piece.

we are primarily using cinema 4d for 3d animation and rendering, and are trying to get a specific camera move exported to terragen2 deep-anim to animate and render in terragen.

so.. after much difficulty i found a way to export my xyz, hpb, and fov info out of cinema. and i reordered in a way i suspect t2 interprets it.. in xyz phb fov order, but im getting some very strange results.
here is a sample of my chan file attempt:
0 89190781 12405563 -328969781 22.661 0.727 63.339 69
1 88275203 12229282 -322887750 22.393 0.849 62.886 69
2 87425750 12065076 -316490594 22.121 0.965 62.461 69
3 86585516 11902583 -310088250 21.849 1.081 62.04 69
4 85727859 11736963 -303829062 21.581 1.197 61.613 69

i have also tried isolating xyz (pos) and phb (rot) values into seperate text file for independent import into the camera using "import animation file" on the respective fields.. but they dont seem to work either.. the furthest ive gotten is the first frame imported correctly, but every frame after is completely wrong - and the application seems to report an incorrect number of frames imported.

so i assume my formatting is incorrect, and after much searching in the forums, i cant find anything to indicate what ive done wrong.

in the meantime, im having the camera exported to maya through fbx with help of a maya artist here, which comes in visually correct, but the position and scale of the scene is changed (i suspect this will cause problems matching the t2 scene). but, im hoping the nuke chan export will shed some light on at least the chan format for me.

please... any and all help will be appreciated.
most importantly, what is the chan file format?
or, what is the format for importing position and rotation values seperately?

i would very much like to see a terragen render in our scene, for quality and wow factor, but if i cant get this working very very soon, we have to abandon this approach for more traditional methods - hacks, compositing tricks, and no terragen....

thanks in advance,
tom allain


Some big numbers there... I can picture the scene now... :-)

The chan format is the Nuke .chan format (although some variants are also supported). A number of "Nuke chan" export scripts for other 3d apps exist and have been shown to correctly export to TG2. I don't know if one exists for Cinema 4d, but if you can get the data into XSI or Maya then there are workable routes to TG2.

I was forwarded an email from you today so I will reply to that now. I'd like to get a complete .chan sample and get more info about the number of frames, coordinate system etc.

Just because milk is white doesn't mean that clouds are made of milk.


hehe yes.. those are the first keyframes that start far from the planet...
we have found a chan export from maya, but the ftp server is hung..
and no, no luck for cinema either.
i think i could figure out how to write a c.o.f.f.e.e. (cinemas scripting language, similar to mel) plugin to export the data, but my programming skills are far to rusty to do this in a timely fashion.

and.. ive been googling for quite some time, and cant find a simple example of a chan file to compare my formatting.. argh!

thanks matt.. looking forward to the email


As some of you know I have been working on a database for managing TG variables for animations. I originally intended to distribute a runtime of the database but in the end the variable controls I was doing required specific programming of the control of each variable which is not possible to do with a runtime (and not practical for the end user).  I have been considering what features of the database could be useful as a distributable runtime, and this sort of stuff is definitely one of them.

If someone can send me a chan file that imports correctly (a couple of lines will do) I should be able to create a converter that allows you to match import columns to the correct field for successful output for TG with additional options for specific circumstances (e.g. reverse camera direction). Either that, or a description of other problems that occur if they are simple ones.  Given that the data is all text it shouldn't really be this complicated. 

For my own uses it will also have a TGS import from terranim and I could add one for campath as well.


well, ive had some success.
turns out my text files had mac carriage returns in them, and t2 likes DOS carriage returns..
so now i have successfully brought in my camera animation using separate pos and rot files, and have been working out the translation of coordinates and scale..
unfortunately, cinema4d cannot match the size of the terragen planet and still animate around it.. it maxes out at 10,000,000, whatever the unit (km/m/cm)

i tried moving the planet object to 0,0,0 to make it easier to translate, and i think many of you will laugh at what you know happened.. :-)

so now.. i am working at 1/100 scale in cinema, and i need to find out how to translate -3.85731e-22, -6.378e+06, 4.08252e-08 into civilizated and humane numbers.. this is bringing back nightmares of calculator overflows as a child lol

im getting close! was awesome to see my animation playing back in t2, tho only with a planet that is 100th the size and no atmosphere....



karsten keppel had given me the insight i needed to understand the measurements used for the planet, and also the problems with my files.. then with some heads put together over here we figured the rest out.. i essentially nulled my entire animation and scaled/positioned it to match a terragen planet representation - all at 1/100 scale of terragen2.

i used the after effects exporter to export its file, and in a text editor, pulled out the keyframes, edited/formated them with bbedit, and then in excel(neooffice open source vers - screw m$!) to scale it all up x100 and flip the h rotation. then fixed the jumps from 0.1 to 359.9  in rotation values with +/- 360, then placed them in 2 text files (DOS carriage returns - western(mac os roman)), 1 for position, 1 for rotation. i abandoned the chan file, since it seems it expects far more than i was placing in it.

position example:
0 17426393.8 132547450.0 -313966350.0
1 17723623.4 130861875.0 -310110050.0
2 18110812.5 129095262.5 -306066300.0
3 18535926.6 127294500.0 -301943550.0
4 18961432.8 125493337.5 -297819875.0

rotation example:
0 -0.172 15.126 67.624
1 -0.352 15.033 67.337
2 -0.535 14.943 67.066
3 -0.721 14.853 66.801
4 -0.906 14.764 66.537

first number is keyframe and the next 3 in pos is x,y,z and in rot its p,h,b

and i dont have to scale the t2 planet!!!

oh, and a quick test i did earlier with t2 keyframing over the surface of the planet, i did a very dirty test render, and it turns out the creative director here showed it to the director of the film, and they loved it.

lets hope all continues to go well, and we can get a render of the final product. :-)



Glad to hear you've found a solution, Tom. Can you give me an example of a frame of coordinates in Cinema 4D along with the final values as they appear in the TG2 Camera? I'd like to work with you to write a working .chan exporter from Cinema 4D so you don't have to go through all those steps each time. If you can send me the code for your exporter I should be able to make the appropriate modifications.

Just because milk is white doesn't mean that clouds are made of milk.


Quote from: tomatomic on April 24, 2007, 11:03:14 pm
i abandoned the chan file, since it seems it expects far more than i was placing in it.

The files you emailed me had the correct number of fields in them. The problems were the line ending, and the order/signage of the fields, we can figure those out.

An excerpt from some comments I added to my .chan reader in TG2:

   Reads a Maya .mov file, Houdini chan file or Nuke chan file.
   If file has extension ".chan" then:
     It is assumed to be a Houdini chan file (7 channels) or Nuke chan file (8 channels)
     Lines with 7 columns are assumed to be from a Houdini chan file without a frame number.
     Lines with 8 columns are assumed to be from a Nuke chan file with the first value being the frame number
     The last column (7th or 8th) is interpreted as vertical FOV
     The last 7 columns are interpreted as camera coordinates in Houdini coordinate space
     It is assumed to be a Maya .mov file (which is identical to a Houdini .chan file if numchannels == 7)
     The 7th column is interpreted as vertical FOV if it exists
     The 8th column is not used
     The last 7 columns are interpreted as camera coordinates in Houdini coordinate space

As for what I mean by "Houdini coordinate space", the 7 fields following the frame number are:

X (as TG2)
Y (up, as TG2)
Z (out of screen, negative to TG2)
Rotate X (pitch upwards, as TG2)
Rotate Y (anti-clockwise* heading, negative to TG2)
Rotate Z (bank left, negative to TG2)
Vertical Field of View

(*) I only call it anti-clockwise as viewed as a heading on a map, but it's actually clockwise as viewed along the Y axis in its positive direction.

Just because milk is white doesn't mean that clouds are made of milk.


Sounds like a great collaborative effort. I can't wait to see the results. :)

- Oshyan


April 25, 2007, 02:17:34 pm #10 Last Edit: April 25, 2007, 02:19:31 pm by tomatomic
yes, this could be very helpful in saving some time. the excel method is a bit laborsome, but im getting faster at it hehe
one important thing for someone else that will want to attempt this is to try and match the cinema scene to a terragen planet, since it seems you really dont want to mess wiht the scale and coordinates of it.
and.. you have to work at 100th scale.. or cinema maxes out in its coordinates. so.. this would have to be taken into consideration.

ill email the files i used now.

next hurdle over here is to figure out render times and the machines we need to render this...


oh, another note.. to take my existing animation and be able to scale/move it around to match my t2 planet representation in c4d, i set up an xpresso (expression/script) to create a duplicate camera without any parents, following precisely the original - this is the one i baked and exported to ensure it was sending out global coordinates rather than local..


Make sure to do a couple of proper animated rendertests before going full tg2 rendering.. We've done a commercial with it and ended up projecting stills from tg2 on exported geometry (from tg2) in maya because the current tg2 renderer doesn't really work in a tight deadline production environement.. especially when you need gi.. which can be expected from a tech prev.

Cheers, Ton.


Quote from: Matt on April 25, 2007, 10:54:39 am
...I'd like to work with you to write a working .chan exporter from Cinema 4D so you don't have to go through all those steps each time. ...

As an addon to this can I repeat a request/suggestion to be able to link variables to text files rather than importing them each time (in a future version). Importing the camera settings in a single file is better than separate files, but there are so many other variables that are unique to TG that can be managed externally that it could be a real pain updating animated settings for each animated variable, not to mention the trouble of actually keeping track of them. 

To avoid clutter you could add a "Link to file" option below "Import animation file..." and have it require a file based on the node name e.g. nodename_variablename.txt in the same directory (or specify a directory in the project settings). Rather than update each import at file open (more time), perhaps an "Update linked files" button in the Sequence/Output tab?


thanks for the advice ton..

im currently doing some render tests to see what quality settings yield what speed of render to plan out our render times.
we will be doing motion blur as a post effect, its possible that will smooth some artifacting.. so far my low detail tests are looking pretty good, and promising.

just need to keep the camera from plowing through mountains LOL