Planetside Software Forums

General => Terragen Discussion => Topic started by: Thejazzshadow on January 08, 2010, 11:20:47 PM

Title: lightwave chan file export done!
Post by: Thejazzshadow on January 08, 2010, 11:20:47 PM
I found this website which just released this plug-in (finally!). I seem to be having problems with it but I'm assuming that is my fault
importing it into TG2. When you Lightwave/Tg2 users use this plug-in can you let me know all that you did?    
Here's the website...
http://mentalfish.com/2009/12/lw-2-nk/
Title: Re: lightwave chan file export done!
Post by: cyphyr on January 09, 2010, 06:26:33 AM
Thanks for the find
I don't think the problems are yours. I'm getting problems with FOV, rotation values (bank swapped with pitch) and frame nos swapped with x position.
If you need animation imported from LW I did a small tutorial re-hashing an old plugin (with authors permission) and using excell to swap the columns about. Its cumbersome, takes some concentration but works. Here's the LINK (http://forums.planetside.co.uk/index.php?topic=5383.0). Ah see you've already been there :)
Richard
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 09, 2010, 12:41:52 PM
I remember I had some problems then but I will take a look at it again or do you think it would be easier to switch the columns from this new plug in? It sounds like it would be easier to switch the four columns that you just said.
Title: Re: lightwave chan file export done!
Post by: Matt on January 09, 2010, 03:57:46 PM
Richard, can you give us a sample (just one line will do)?
Title: Re: lightwave chan file export done!
Post by: cyphyr on January 09, 2010, 04:49:24 PM
Here's the .chan I exported earlier from Lightwave, unfortunately I didn't save the Lightwave file.
After I've finished my current render I'll make up a complete Lightwave > .chan > Terragen set and up load it.
:)
Richard
Title: Re: lightwave chan file export done!
Post by: cyphyr on January 09, 2010, 05:52:47 PM
Heres the files
Title: Re: lightwave chan file export done!
Post by: Matt on January 09, 2010, 05:58:38 PM
Thanks. The problem with this file (for Terragen) is that it doesn't have any FOV column so there are only 7 columns. When TG sees 7 columns it assumes that the file has no frame number at the start because that is another common variation, and then it thinks the first column is TX instead of the frame number and the last column is the FOV instead of RZ. Is there an option in the LScript to write the FOV channel, or could you edit the script yourself to do this? If not, is there an option to omit the frame number? Either of those changes should allow TG2 to read the chan file.
Title: Re: lightwave chan file export done!
Post by: cyphyr on January 09, 2010, 06:06:59 PM
No options in the script. Maybe some one will mention this to the author. Its intended for nuke, not terragen so I guess he's unaware we're piggybacking on his work, lol
Richard
Title: Re: lightwave chan file export done!
Post by: nixx on January 11, 2010, 09:43:09 AM
Is there still a need for this or have you guys found a solution ? Because if the "problem" (or shortcoming) is in the L-script, I can help.

Let me know.
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 11, 2010, 12:43:02 PM
I haven't heard of the solution. You can see what the problem is and the link to the Lscript above.
Title: Re: lightwave chan file export done!
Post by: nixx on January 11, 2010, 01:04:33 PM
Ok, just a couple of questions :

do you need it to export motion from any selected object (I would think yes) ?

And, since TG2 accepts .chan files for any object, what about the FOV column ? Is it simply ignored when the .chan is applied to objects other than cameras ?

That last question is probably best directed at Matt, I guess.

Let me know, and I think I 'll have something very soon.
Title: Re: lightwave chan file export done!
Post by: cyphyr on January 11, 2010, 01:25:35 PM
I've imported .chan animation files made for a camera and attached them to an object and it worked fine.
Richard
ps I created a 'chan solution a while back but its ropey, uses an old Lightwave TGS export script and moves the data about in excel. Works but its clunky.
link (http://forums.planetside.co.uk/index.php?topic=5383.0)
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 11, 2010, 02:33:24 PM
It probably should be directed for all objects though I personally want it for camera movement at the moment.
Title: Re: lightwave chan file export done!
Post by: nixx on January 11, 2010, 02:49:42 PM
Ok guys, give this one a try.

You can export the motion of anything, with or without frame numbers in the .chan file (normally you should include them, but the option is there if you need it). Also, if you export a camera motion, you have an extra control to select which camera FOV you want (normally you want "vertical", which is the default, but again the option is there).

The default filename for the resulting .chan file is auto-set each time to "Motion([item's name])" for convenience.

Let me know how it is. And of course if you find any bugs, have any ideas to further improve it, or need something else, give me a shout.

Edit : Attachment removed, see further down for fixed version
Title: Re: lightwave chan file export done!
Post by: MarkTheShark on January 11, 2010, 04:14:14 PM
Was actually going to post a link to this shortly once I had emailed the guy as I had edited it so just wanted his permission to post it but what the hell someone beat me to it  ;D

Cheers for that Nixx much better and more useful than what I done.

Think all I did was add an extra value at

"content = string(content, n, "\t", xPos[n], "\t", yPos[n], "\t", zPos[n], "\t", xRot[n], "\t", yRot[n], "\t", zRot[n], "\t", "\60", "\n");"

Which just put the default 60 FOV in. It was the first time I had ever looked at an LScript so I was happy  :D

Anyway I did a 600 frame animation with mines already and it came out the same as in lightwave. and the values I got using your script seem to match up.

Only thing is, and I got it with my edited script, is that when importing into Terragen it comes up with an error which reads:

QuoteCamera: Import File: .chan files are expected to have 7, 8 or 10 columns: (Insert link to .chan file)

But as I said mines got the same and everything still worked fine.
Title: Re: lightwave chan file export done!
Post by: nixx on January 11, 2010, 04:43:15 PM
Quote from: MarkTheShark on January 11, 2010, 04:14:14 PM
Think all I did was add an extra value at

"content = string(content, n, "\t", xPos[n], "\t", yPos[n], "\t", zPos[n], "\t", xRot[n], "\t", yRot[n], "\t", zRot[n], "\t", "\60", "\n");"

You don't need the backslash or the quotes - the whole thing is converted to a string. But the basic idea was right.

QuoteWhich just put the default 60 FOV in. It was the first time I had ever looked at an LScript so I was happy  :D

But that would not work for altered, or even worse, animated FOV (zooming in/out during the animation). Actually getting the camera FOV for each frame (what my version does) will always give accurate results.

QuoteOnly thing is, and I got it with my edited script, is that when importing into Terragen it comes up with an error which reads:

Camera: Import File: .chan files are expected to have 7, 8 or 10 columns: (Insert link to .chan file)

Ah yes, I see it too. Sorry it was a quick job and I didn't test it properly. This is a tab problem, I now set it to insert two tabs between values, and in a few quick tests it works fine. Try this one :

Edit : Nothing to see here people, move along... (a little further down for the final version :))
Title: Re: lightwave chan file export done!
Post by: cyphyr on January 11, 2010, 05:12:39 PM
Very cool, thanks :)
For some reason I'm only getting 60 frames worth of data, I'm expporting 100 frames from LW but TG is only getting 60. On opening the .chan file I see it stops at frame 60.
Thanks for putting the effort into this.
Richard
Title: Re: lightwave chan file export done!
Post by: nixx on January 11, 2010, 05:17:03 PM
Quote from: cyphyr on January 11, 2010, 05:12:39 PM
Very cool, thanks :)
For some reason I'm only getting 60 frames worth of data, I'm expporting 100 frames from LW but TG is only getting 60. On opening the .chan file I see it stops at frame 60.
Thanks for putting the effort into this.
Richard

Richard, the script exports your render range, not your preview range. I bet your render range is 1-60 :)

Would it be useful to have the option which range to output ?
Title: Re: lightwave chan file export done!
Post by: cyphyr on January 11, 2010, 05:19:32 PM
That'll be it then lol, Never even thought to change that as it was just for a test  ::)
Thanks again
Richard
Title: Re: lightwave chan file export done!
Post by: MarkTheShark on January 11, 2010, 05:41:17 PM
Thanks once again nixx, my plan to change FOV was to always go in and change it manually :'( of course this would never be feasible with animated FOV!!

And thanks for the tip with my "/60". going to have to try learn the basics of creating scripts.

Cheers for the quick fix aswell, not tryed it but sure it will work fine  ;)

Don't worry cyphyr, I did the same thing  :-[
Title: Re: lightwave chan file export done!
Post by: nixx on January 11, 2010, 05:57:53 PM
Glad to be of help guys.

Actually, there's still a bit of a problem that I 'm looking into right now. TG2 may still give you an error when you import the .chan file. I 've pinpointed it and I 'm fixing it now. When it's ready I 'll re-upload.


Update : This is the final, it should work flawlessly in all cases, for any LW item, supports negative frame numbers and has the option to export either the preview range or the render range ;). I hate to sound like a broken record, but... let me know :P
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 11, 2010, 11:52:39 PM
I for some reason am having trouble with this. I am not seeing anything in the 3D preview. Is there anything that I should be doing instead of just clicking export in Lightwave and clicking import in chan of camera?
Title: Re: lightwave chan file export done!
Post by: Oshyan on January 11, 2010, 11:59:50 PM
This looks like a great tool. Don't let it get lost in this thread! Post it over on www.terragen.org perhaps?

- Oshyan
Title: Re: lightwave chan file export done!
Post by: nixx on January 12, 2010, 12:13:00 AM
@ Thejazzshadow : After you hit "import", try refreshing your preview, or even rewind your scene and let it play back a few frames. I 've found that sometimes TG2 doesn't automatically update after you import a motion file. In my tests it worked right every time, but if there really is a problem with the script, I 'll take another look of course.

Oshyan, thanks ! :) As soon as we 're 100% sure it works as it should, sure, why not. Also, please feel free to copy/move it to whatever other thread you feel may be more suitable.
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 12, 2010, 01:38:00 AM
I'm not sure what is wrong. Here is the chan file I made. It was just basic movement (y,z) with no rotation.
Title: Re: lightwave chan file export done!
Post by: MarkTheShark on January 12, 2010, 02:04:46 AM
Quote from: Thejazzshadow on January 12, 2010, 01:38:00 AM
I'm not sure what is wrong. Here is the chan file I made. It was just basic movement (y,z) with no rotation.

Works fine for me.

Looking at your past posts I'm guessing you have Terragen with animation ye? I'll admit I was stuck for a while before I realised the version I had wouldn't animate!

Can't think of anything else, all I did was open your .doc file, copy and pasted into notepad and saved as .chan file and then imported into Terragen. I still got the error about lines but im guessing you made it before the fix?
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 16, 2010, 08:46:36 PM
I do have Tg2+ animation. For some reason it is only importing the first keyframe but the .chan file looks fine. Any ideas?
Title: Re: lightwave chan file export done!
Post by: Matt on January 17, 2010, 12:02:24 AM
Can you please attach the file you're trying to import?
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 17, 2010, 01:06:09 AM
Here it is.
Title: Re: lightwave chan file export done!
Post by: Matt on January 17, 2010, 11:15:23 AM
Thanks. There is something unusual about this file which Terragen doesn't understand, but if I open it in WordPad and copy the contents into a new text file called test.chan it imports OK. Perhaps it's the line endings, or the whitespace character. I'll find out what it is.
Title: Re: lightwave chan file export done!
Post by: Matt on January 17, 2010, 11:44:17 AM
The line endings are CR, not CRLF. I thought TG2's importer was OK with CR line endings, but perhaps not.

I don't know LScript, but the code uses "\n" so I would expect that to be CRLF if you export on Windows. If you're on the Mac then maybe it's just CR, but in that case TG2 on the Mac should be able to import with just CR.

What OS did you export and import on?

Matt
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 17, 2010, 01:32:17 PM
They were both on mac.
Title: Re: lightwave chan file export done!
Post by: Matt on January 17, 2010, 02:11:42 PM
It looks like Terragen 2 on Mac OS X is expecting the LF character (which is the standard newline character on OS X and Linux), but LScript on the Mac still writes the CR character which was the standard on Mac OS 9.

I wonder if there's some way to get the LScript to treat "\n" as LF instead of CR.

Matt
Title: Re: lightwave chan file export done!
Post by: nixx on January 18, 2010, 04:17:26 AM
I 'll try to modify the script to work with LF (Line Feed, right ?) instead of \n (Carriage Return). I 'll see if I can have it up by tonight.
Title: Re: lightwave chan file export done!
Post by: nixx on January 18, 2010, 07:36:12 AM
Ok, please try this one. I dropped the "\n" (which were left over from the original script, I never use \n anyway) and modified it with what should be line feeds instead.
Also, this latest version should have no problems with exporting lots of frames (500+) on slower machines with low RAM (the previous version would "complain" ;))

Let me know if this does it.
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 18, 2010, 01:45:23 PM
I tried it and it is still doing the same thing. It does the first frame (green numbers) and the rest are blue and the same values as the first frame. The chan file still looks fine in text editor.
Title: Re: lightwave chan file export done!
Post by: nixx on January 18, 2010, 03:45:46 PM
Can you strip your LW scene file from its content, keeping only its camera move, and send it to me ? Since the script works for everyone else who's tried it, maybe yours is a rare case which I 'd like to look into.
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 18, 2010, 04:05:40 PM
Here it is. Has it been conformed that this has worked for mac users?
Title: Re: lightwave chan file export done!
Post by: nixx on January 18, 2010, 05:11:02 PM
Quote from: Thejazzshadow on January 18, 2010, 04:05:40 PM
Here it is. Has it been conformed that this has worked for mac users?

No, I forgot about the "mac" part, sorry. I 'll see if it can be fixed.

Update : Try again please. I don't have access to a mac so you 'll have to do the testing, sorry :(

edit : attachment removed (didn't work)
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 18, 2010, 06:00:46 PM
Doesn't work yet. I also tried baking the motion just in case but there is still the same problem. I assume you've read the above posts on what the problem is?
Title: Re: lightwave chan file export done!
Post by: nixx on January 18, 2010, 06:09:54 PM
Quote from: Thejazzshadow on January 18, 2010, 06:00:46 PM
Not yet. I assume you've read the above posts on what the problem is.

Well there wouldn't be much point in making blind modifications, would there ;)

Last try : This one does not work right in Windows, but it might on your mac. I 've now tried all combinations of LF, CRLF and CR (this one). It's a long shot, but give it a try.

Edit : Another one bites the dust. Latest working version, 6 posts up (so far 100% functional on Windows only).
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 18, 2010, 11:01:03 PM
Sorry but it is still not working. :(
Something that I just noticed, the original plugin was done on mac.
Title: Re: lightwave chan file export done!
Post by: nixx on January 18, 2010, 11:36:53 PM
That shouldn't make any difference. I have tried both the original coder's way of creating the output file and my own. Did the original plugin work right for you ?
Title: Re: lightwave chan file export done!
Post by: Matt on January 18, 2010, 11:37:03 PM
Quote from: nixx on January 18, 2010, 06:09:54 PM
Last try : This one does not work right in Windows, but it might on your mac. I 've now tried all combinations of LF, CRLF and CR (this one). It's a long shot, but give it a try.

I would think CRLF or LF is expected by TG2 on both Windows and OS X, but I'm not 100% sure about that.

Jazzshadow, does it work if you just copy the lines from one chan file into a brand new file? Perhaps you can download a text editor that can show you the newline characters so that you can test which modifications to the .chan file will work. I don't have access to my Mac at the moment so I can't try it. Once we know which combinations work, we can find out why none of nixx's versions of the script worked so far.

Matt
Title: Re: lightwave chan file export done!
Post by: nixx on January 18, 2010, 11:44:31 PM
Matt, so far I tried LF, CR and CRLF, none worked for Jazzshadow.
Let's try to get to the bottom of this, I wouldn't want to leave this only half-functional ! I 'll be around keeping an eye out, but in the meantime, if you nail it, give me a shout and we 'll try again ASAP.
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 18, 2010, 11:53:34 PM
I'll have to try that. Something else I noticed is when I uncheck the include frame number, I get animation but it's nothing like what I exported.
Title: Re: lightwave chan file export done!
Post by: Matt on January 18, 2010, 11:55:44 PM
Does this chan file work? I've made sure it has CRLF, and zipped it so hopefully nothing should be invisibly converted when you download it.
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 19, 2010, 12:02:51 AM
Ya! What does this mean?
Title: Re: lightwave chan file export done!
Post by: Matt on January 19, 2010, 12:09:30 AM
Great. Now what about this one, which is LF only?
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 19, 2010, 12:14:19 AM
Works again. For some reason, the chan's you are giving me I can't open in text edit whereas the ones I exported I can. What program do you use to compress?
Title: Re: lightwave chan file export done!
Post by: Matt on January 19, 2010, 12:24:37 AM
I think test_CRLF.chan was created with Notepad on Windows (copying and pasting the lines from your file that didn't work). I verified that all the line endings were CRLF by viewing in Notepad++ written by Don Ho. I then compressed it to a .zip using Windows 7's built-in zip compression, but I think the zip compression is irrelevant here.

test_LF.chan was processed through a simple program called ConvertCRLF to convert all line endings to LF, and zipped using IZArc.

The only weird or important thing about the formatting of these files is the line endings, whether they are CRLF (Windows) or LF (Unix and Max OS X).

i am surprised that Text Edit on OS X can't view these files! You mean the .chans, not the .zips that contain them? You were able to extract the .chans to test in TG2. What errors do you get, if any? Do you see anything at all?
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 19, 2010, 12:28:31 AM
Actually I got it to work now. I had to open it within Text edit. There were no recommended programs for the zip. I actually imported the zip files and TG2 accepted it.
Title: Re: lightwave chan file export done!
Post by: Matt on January 19, 2010, 12:33:04 AM
Ah, got it.

So it looks like CRLF and LF endings both work in TG2 on the Mac and on Windows. Just need to figure out how to get the LScript to export those line endings. I wonder if one of the versions nixx created already would have worked, but got missed in the confusion of so many versions being updated and downloaded.
Title: Re: lightwave chan file export done!
Post by: nixx on January 19, 2010, 12:41:04 AM
Every different version was up long enough for Jazzshadow to test, then removed in order to avoid confusion for other users. If you want me to, I can re-make and re-upload them. Might be a limitation/bug/"feature" of lscript ? Do you think it would be worth the time to make it work in binary mode, writing 0D/0A bytes ?
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 19, 2010, 12:44:29 AM
Actually in Text edit, I only see the numbers. I don't see any line endings?
Title: Re: lightwave chan file export done!
Post by: Matt on January 19, 2010, 01:21:11 AM
Quote from: Thejazzshadow on January 19, 2010, 12:44:29 AM
Actually in Text edit, I only see the numbers. I don't see any line endings?

That's OK. The line endings don't show in most editors, as it's usually only programmers that have to worry about them. But there are editors out there which have options to show them.
Title: Re: lightwave chan file export done!
Post by: Thejazzshadow on January 20, 2010, 04:37:33 PM
4 pages of this forum and now finally it works! Thanks to you both Matt and Nixx. Unless you really want to keep working with this, Matt's idea only takes 30 seconds longer. I downloaded TextWrangler, opened my chan file, clicked save as, changed line ending to anything but CR. No problem. Nixx, I don't know if you've posted your changed plugin for Windows already but if you can add one of your mac plugins you gave me + TextWrangler for Mac users  ,http://www.barebones.com/products/TextWrangler/download.html, then we will be done with this 4-5 page topic!


Title: Re: lightwave chan file export done!
Post by: Kadri on August 27, 2011, 01:50:53 PM

Thanks  Nixx ! The script ( TG2ChanExport v1.1.zip) worked for me very well :)