A while back I did a bit of work on Terranim/CamPath scripts to Terragen2 (T2) CHAN file conversion (and visa versa) and, until we get better animation facilities, I'd like to share it (and I'm also looking forward to Big Ben's animation utility which should render most of this post redundant ;)).
For those of you with a bit of basic trigonometry, the doc. contains the maths (I've included a pdf. for those without Word as Wordpad misses out some graphic elements which make the formulae ambiguous). I've accounted for T2 using 'Y' for height and the conversion maths allows for banking angles as well. There is also a section to create stereo CHAN data from mono (ie. similar to Stereoscopic) based on a simple 'forward parallel' camera arrangement.
For those without the maths but access Excel or similar, here's a 'quick and dirty' method to produce a conversion from a Terranim script to T2 CHAN data - see the example Excel file. The terrain was just a standard 256*256 heightfield (called 'hill_test') but any size applicable to Terranim/Campath could be used. The test animation goes along a heading of 45 degrees, in a straight line from coordinates 0,0 to (almost) 50, 50, at a height of 30m with 45 degree bank, producing a Terranim script.
Its a few weeks since I did this so apologies if I've forgotten anything (and it may require a bit of experimentation on the user's part) but here is the basic workflow for Terranim to CHAN conversion-
1. Import the Terraninm script, starting on the second column, and format as shown, (using 'text to columns etc.).
2. In the first column add numbers to the 'campos' lines only (this can be done automatically in Excel).
3. Pull down the formulae scripted in the G to L columns - this will produce lots of redundant data which needs to be discarded (I said it was 'quick and dirty'!)
4. To discard the redundant data, first copy all of the data onto a new sheet (in case you make a mistake and need to start over) and discard columns B to F (so keeping only A & G to L).
5. Sort this new sheet based on column A and delete all of the data which has no number in column A (this should all be bunched together after the sort and so can be selected easily in one go).
6. The result will be CHAN file data which can be copied and pasted straight into a new Notepad (etc.) .txt file. This should then be uploadable as a CHAN file directly into T2 (no need to change the extension - on my system T2 accepts .txt files as CHANs).
As mentioned in the doc., T2 negates certain values in the import process - columns 3, 5 and 6 of a 'chan' file. The Excel formulae need to take account of this. Also, 'chan' .txt imports ok but T2 doesn't always show the three camera angle coordinates (2nd line) although these should animate ok.
The 'old' system (Campath etc.) used six coordinates (3 for camera position, three for target) and a bank angle. T2 uses 3 camera positions and angles of elevation, rotation and banking. Moving from 'old' to T2, the Y and Z coordinates are swapped (Z is height in the 'old' system, Y is height in T2).
The above method could be used to convert the two scripts output by Stereoscopic to give left and right eye CHAN data for T2 to render.
I hope I've remembered everything. Best of luck!
Had a few delays at home for this. I hope to have it out next week. It should be a bumper week for me next week, with an updated TER/image set for the Grand Canyon being almost ready. Couldn't connect to the USGS site for a while, and NASA is still proving troublesome for downloading Landsats.
But back to animations.... If you use flatten first for your terrains, Terranim and Campath will give you pretty accurate scripts. The new version of Campath also looks quite useful for interpolating control points collected from TG2 as it allows you to define a custom plane without loading a TER.
And mixing both... rendering a flyover of the Grand Canyon terrain although I'll probably stop after every 32nd frame is rendered (29,000 frames). The number of frames in the TGD doesn't appear to be causing any problems. The only noticeable difference is that it takes about 15-20 secs to create the render camera for each frame.
Do you think that you'll be able to release your TGS -> Chan script sometime this week?
Have been on holidays... Just tidying up some basic documentation tonight and I'll post it "as is" in the morning. I've been rendering another flythrough of the Grand Canyon with some basic surfacing (including a relatively accurate river) and have added in some extra progress tracking options.
Thanks, Ben :). I haven't followed this extremely closely, but what language is it written in? Could it be run on a Mac?
Some of the stuff I've done is Windows specific (batch files for rendering, copying/renaming files etc...) but it is technically possible for me to produce a Mac version as well. It's a runtime of Filemaker Pro so it's not too big a deal to produce a Mac version. My biggest stumbling block is getting access to a Mac to install Filemaker and compile the runtime, although this would only be a one off need as updates simply require replacing the database. And on the off chance that you have Filemaker, you could just grab the database, but it's not something I'd expect many people to have.
The CHAN conversion should be platform independent, so it could be used for that. There'll be screengrabs in the documentation so you can have a peek at that and see if it might do what you want.
Ok, thanks :).