PDA

View Full Version : How to import a Maya camera!


Simon Wicker
06-26-2005, 06:19 AM
hi everyone,

sorry this has taken so long to sort out but my wife gave birth last week to our new son and our priorities have been re-arranged somewhat!

anyway for people who are interested here is a small explanation of how to get exact camera data out of maya and into cinema 4d. this is pretty much one of those last resort kind of things (because it requires you to have maya anyway). my explanation kind of assumes that you already know how to use maya and cinema and just need a nudge in the right direction.

start out in maya and select the camera you need to export. at the top right of the screen click on the toggle to show the channel box/layer editor. choose file/export selection and show the export dialog. change to the export format to the .move format (this will create a basic tab delimited text file upon export). swipe over the channels you wish to include in your export, depending on the situation this would be the channels for translation, rotation and scale as well as the horizontal aperture width and focal length (as this defines the fov in cinema) and then click the 'add from channels' button in the export dialog to add these to your move file. aperture width and focal length have to be added manually to the list in the export dialog using the format of camerax.fl or camerax.hfa (you can see the correct extension to use if you click on the 'channels' menu in the channel box and choose channels/channel names/short). once you have finished adding the channels you wish to use you can click on export selection and save the move file. i tend to make sure i use a .txt extension for the file as most macs and pc's will get mighty confused by the default .mov extension which generally belongs to quicktime).

the next step is to open the move file in a text editor (such as notepad on the pc or text wrangler on the mac) and then at the top of the file add in the names of the channels as tab delimited text. this isn't entirely necessary but i like to do that so i can keep track of what the channels actually represent, so i will add in tx (tab) ty (tab) tz (tab) , etc. as the first line. save this altered text file.

now open up a copy of my cinecam template (i've attached this to this post) and select the null Raw camera data. from the plugins menu choose cinema 4d/ascii animation import and locate your move file. in the dialog that appears you will need to set headline to be checked (so the names you gave the channels are used as the names of the sequences created), separator is set to tab, track is set to real, and time is set to frame. press okay and cinema should tell you that it has succesfully imported the data. open the timeline and you should see that you now have tracks representing your camera data. you now need to drag them to the correct places (tx ty and tz should be dragged and dropped onto the X Y Z sequences of the null Camera_trans, rx ry and rz should be dragged to Camera_rot). should you have included it there is also a null for other camera data, position X being for focal length and position Y being for the horizontal aperture width. there is an xpresso expression that takes all this data and pipes it into the camera called shot_layout_v1. the xpresso expression compensates for the different orientation of the axes in maya and the fact that maya measures the aperture width in inches.

you should now have a camera that matches the camera in maya! you can now bake the shot shot_layout_v1camera so it becomes independant of the expresso set-up. finally you just have to remember to adjust your render settings to match the maya cameras aspect ratio.

cheers, simon w.

CosmicBear
06-26-2005, 08:17 AM
Congratulations on your new baby!! :thumbsup:

And thank you for the explaination! :D That's fantastic!!

ThirdEye
06-26-2005, 09:31 AM
Congratulations to you, your wife and your new son Simon :)

Srek
06-26-2005, 09:39 AM
Great news :)
Best wishes to you and your family from me and my wife Yvonne.
How come we never saw a wip? :twisted:

Cheers
Björn

lllab
06-26-2005, 12:22 PM
congratulations for your son!

and thanks for the tipp.
cheers
stefan

Simon Wicker
06-26-2005, 03:49 PM
thanks everyone. calvin is doing well and his sisters are very happy to have a baby brother to look after.

cheers, simon w.

chris_b
06-26-2005, 07:27 PM
Simon... that is wonderful news. Congratulations to you and your family :applause:

Also, many many thanks for sharing this. It is something that I will be using very often. Absolutely fantastic explanation. Maybe at some point we'll get a .ma importer? After all,
if After Effects can read an .ma, then it is probably a fairly simple thing.

Thanks again. :)

Rev9
06-26-2005, 07:30 PM
Can ypu post the wireframe mesh??

Congrats Daddy-O!

Best
BT

bonsak
06-26-2005, 08:04 PM
Congratulations Simon, have one myself so i get the idea about priorities being different :-)

Your template could probably work for anim data coming from AE as well.
We have projects all the time that we start of in AE (because its our main tool)
just to realize we need some 3d elements added or we realize we have to finish every thing of i C4d.
We never figured out how to do this so this might be the solution.
I dont have AE at home but ill try it tomorrow.
Anybody know how this expresso rig needs to be reconfigured for this to work?

AE anim data look like this:

Adobe After Effects 5.0 Keyframe Data Units Per Second 30
Source Width 720
Source Height 576
Source Pixel Aspect Ratio 1.06667
Comp Pixel Aspect Ratio 1.06667

Position Transform Effect Parameter #2
Frame X pixels Y pixels z pixels
40 379.676 274.557 0.000
41 379.705 274.878 0.000
42 379.616 275.353 0.000

Regards
Bonsak

govinda
06-26-2005, 08:31 PM
Congratulations!

And thanks for this! I was stuck in mismatched mayacam world awhile back and know the pain.

JoelOtron
06-26-2005, 08:31 PM
Wow--this is defiitely one to copy into my scrap file--thanks for sharing.

Also--I believe you've really got your priorities mixed up.
Congratulations! Guess its old hat at this point. :)

Simon Wicker
06-26-2005, 11:30 PM
Your template could probably work for anim data coming from AE as well. We have projects all the time that we start of in AE (because its our main tool) just to realize we need some 3d elements added or we realize we have to finish every thing of i C4d. We never figured out how to do this so this might be the solution. I dont have AE at home but ill try it tomorrow. Anybody know how this expresso rig needs to be reconfigured for this to work?

AE anim data look like this:

Adobe After Effects 5.0 Keyframe Data Units Per Second 30
Source Width 720
Source Height 576
Source Pixel Aspect Ratio 1.06667
Comp Pixel Aspect Ratio 1.06667

Position Transform Effect Parameter #2
Frame X pixels Y pixels z pixels
40 379.676 274.557 0.000
41 379.705 274.878 0.000
42 379.616 275.353 0.000


Hi Bonsak,

depending on the 'handedness of after effects (i.e. how it arranges the axes) you may or may not need the 'maya' style axis flipping that i have included in my xpresso setup. looking at the way AE is organising the text file it exports you will need to strip out anything above the headline (the Frame X pixels Y pixels Z pixels line) and in the ascii animation import dialog tell cinema that the first set of numbers represents the frame number.

you may also have to split the file into sections as it seems that AE may be placing the rotation data after the translation data rather than alongside it.

if AE has the same axis set-up as cinema you would just need to import this to a null and then drag the tracks to your camera. most of the tricky stuff i implemented was just to deal with the flipped z axis in maya.

cheers, simon w.

bonsak
06-27-2005, 09:28 AM
Hi Simon
Thanks for the info on AE.
When i try to import this file (AE keyframes) as comma delimited text, i get one track for each value. :-)
Ive tried other formats but this is the only one that generates tracks so far.
I checked "header" and "comma"

Frame,X position,Y position,Z position
0,109,288,0
1,114.055,288.095,0.0950346
2,118.036,287.116,-0.88406
3,123.914,288.034,0.0336009
4,128.986,288.145,0.144902
5,134.233,288.432,0.431867
6,138.289,287.528,-0.471938
7,144.059,288.336,0.336467
8,149.076,288.393,0.393323
9,152.877,287.233,-0.76693
10,...........

Do you have an example of the Maya export so i can compare?

Regards
Bonsak

Simon Wicker
06-27-2005, 03:13 PM
hi bonsak,

i've attached a maya move file. can you attach your sample AE file so i can test it out here? it may be that you need to do a find and replace on the commas and make them tabs. if it turns out to be a bug i can let maxon know.

cheers, simon w.

joss3D
07-23-2005, 11:01 PM
hi, I'm trying to importe a camera from maya to C4D.

all the translate and rotation channels tranfert weel with simon's thechnics.
it's ok for the focal lenght but i have problem with the film aperture.

in maya there is 2 attributs: horizontal and vertical film aperture
but in c4d I don't find something equal.
there is the field of view but with the simon's technic, when i render in c4d, it's doesn't match with the maya render.

moreover, i have to connect manualy in the xpresso the relation between the camera data and shoot_layout_V1, as you can see in the attached picture

can you explain how you can transfert good Aperture info from maya to C4D?
why you only use the horizontal apertur and not the vertical one?

help or advice will be very apreciate

Simon Wicker
07-23-2005, 11:20 PM
hi joss,

the only information needed by cinema is the horizontal aperture width (as cinema sets the aspect ratio of the image through the render settings, whereas in maya the camera has an aspect ratio as well as the rendersettings).

in my set up that i posted if you include the horizontal aperture width from maya using the .move format then there is a place in the xpresso for this (running the maya aperture width through a multiplier to convert it into the mm's expected by cinema) otherwise you can simply add this information into your baked camera by hand at the end, but you need to convert from inches to mm yourself.

either way gets you the right result.

cheers, simon w.

joss3D
07-24-2005, 09:49 AM
hiii simon,
first thank's for you quick ansswer.



(as cinema sets the aspect ratio of the image through the render settings, whereas in maya the camera has an aspect ratio as well as the rendersettings).
.
ok I didn't see this major part of C4D for the camera settings.
But I already have problems.
you can see on the attached file a gif how show the difference between c4d and maya render.
(and there is a big one oO)

here the main steps I did:
first setup a scene in maya, with a simple mesh and a camera.
in the camera settings, i use the preset "35full aperture" so that i have a ratio of 1,333;
I export the cam with a .move file.
In C4d (I imported the mesh with a 0,01 scale due to my maya unit), did what you say in your post (with your cam)and choose in the render settings the preset 35 mm Full. I tried with other type of cam and I have alwways the same offset on the render;
(But the 35mm Ful seems to be the more accurate compare to others preset)

here is the maya and c4d scene with the .move on a attached zip library
It's very kind of view if you can check this files for your pleasure and my pleasure.
cause it's running me crazy for a long time ago!

Simon Wicker
07-24-2005, 05:34 PM
hi joss,

unfortunately i'm on holiday at the moment and don't have access to maya at home. looking at the gif the two things that you might need to check are that in cinema and maya the camera fov matches (this is actually the most important value, because of the way cg cameras are made the focal length and aperture width are freely adjustable and as long as the fov is the same the view will be too).

if they are different you will need to bake the cinema camera and then type in the maya camera fov manually - ignore any changes that happen to the focal length and aperture width.

also you might need to check the scene scale. cinema can sometimes render a distorted image if the scene scale is too small. if this is the case you might need to bake the camera and then put the whole scene in a null and scale it up x10.

cheers, simon w.

funcrusherplus
01-26-2006, 08:43 PM
Has anyone tried this method for Cinema aperature?? I am currently researching the possibilites of importing motion control data into maya, and bring that into cinema. this would need to be 100% perfect.

Has anyone tried anything like this??

Simon Wicker
01-26-2006, 10:33 PM
if you can get your motion control data boiled down to a single camera in maya then you will be able to convert that into cinema without a problem. however if you are trying to transfer a hierarchy from maya to cinema then you will be out of luck. the only way to do this would be to use the .fbx format to carry the data and .fbx from maya to cinema is broken and needs to be fixed by alias.

cheers, simon w.

funcrusherplus
01-26-2006, 11:02 PM
Edit: I think I found some solutions. Thank you for your help!

Per-Anders
09-25-2006, 10:21 AM
Just bringing this very useful thread into the tips section.

Kokosing
11-15-2006, 04:19 PM
I just noticed that the Shake multiplane node can import cameras in the maya ascii format. Is there a way to get this out of C4D?

Otherwise, I guess I'm looking at matchmoving my renders (howzat for backwards?)

Thanks for any suggestions,

W

Simon Wicker
12-14-2006, 11:06 PM
i've been doing some more investigations into this as i recently came across a maya scene file that i was not able to correctly translate into cinema (the markers slid against the live action background in cinema when they were rock solid in maya). the scene originally came from boujou bullet and the matchmove scene was saved into maya.

the only difference that i have been able to locate between this file and others that have correctly translated to cinema is in the rotation order used by the scene. zxy WORKS, xyz DOES NOT WORK!

it seems likely that unless your maya scene uses a zxy rotation order then my method that i've outlined here will not work for you!

i'm looking into this and will report if anything else turns up.

cheers, simon w.

chris_b
12-19-2006, 04:41 PM
That is frustrating.... I guess a .ma import plugin would be the best solution... or even better some kind of interchange functionality ala what is going on with XSI these days. Wasn't somebody here (TCA Studios?) working on a .ma camera import?

Simon Wicker
12-22-2006, 10:12 AM
it is looking hopeful that a third party is going to come up with a solution to this so fingers crossed!


cheers, simon w.

ArndtvonKoenigsmarck
12-27-2006, 10:22 PM
Indeed :-)
I am just working on an import/export plugin for the .ma format.
A first version can be released soon as long as no bugs show up.
I someone wants to do some betatesting for me, please drop me a line (C4D v10 needed).

shoqman
12-31-2006, 07:02 PM
Wow! That's great news!
Somebody jump on board and test! I would, but I don't have R10 yet.
Keep us posted!

-shoqman

CGTalk Moderation
12-31-2006, 07:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.