Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Exporting Camera (with Shake Enabled) possible?

nick.guth
Explorer

Exporting Camera (with Shake Enabled) possible?

nick.guth
Explorer
Explorer

Hi there. I've run into an issue trying to export a camera from Maya to Nuke. The camera inside Maya has "Shake" enabled and is running a MEL script like this:

 

camera_lay_v003Shape.horizontalShake = noise(frame/20)/1000;

cam_lay_v003Shape.verticalShake = noise(frame/15)/1000;

 

The problem is when I export the camera it seems to ignore the shake and the two do not line up. However, my renders from Maya DO include the shake. I've tried all sorts of things to get it to bake out properly, but nothing is working.

 

Any insight on how to export the camera properly with all the shake properties too? 

0 Likes
Reply
Accepted solutions (1)
6,671 Views
7 Replies
Replies (7)

sean.heasley
Alumni
Alumni

Hi @nick.guth and welcome to the community!

 

This may be more of an issue on Nukes end but I found this video that may help!

 

 

Its a bit dated but please let me know if it helps or if you need any more assistance!

 

 

If one or more of these posts helped answer your question, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

 

 

 

Kudos are greatly appreciated. Everyone likes a thumbs up!

 

 

0 Likes

sean.heasley
Alumni
Alumni

Hi @nick.guth

 

I'm just checking in again to see if you need more help with this. Did the suggestion I provided yesterday work for you?

If so, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

0 Likes

nick.guth
Explorer
Explorer
Accepted solution

The solution we came up with worked, but it has to do with both NUKE and MAYA. Here's what we did:

 

INSIDE MAYA

The default shake expressions are applied to a parameter called 'verticalShake' and 'horizontalShake'. Unfortunately, nuke can not read that. 

 

camera1Shape.verticalShake = noise(frame/15);

camera1Shape.horizontalShake = noise(frame/20);

 

However, it CAN read it if it's applied to the filmback (and the maya documentation explains these properties are identical in nature). So we copied those expressions and applied them to the film offset parameter in maya. 

 

camera1Shape.verticalFilmOffset = noise(frame/15);

camera1Shape.horizontalFilmOffset = noise(frame/20);

 

We then baked those two channels (and disabled the checkbox for Shake). Exported it out as FBX and brought it into nuke. 

 

INSIDE NUKE

Here is where things get a little tricky. Nuke and Maya use two different measurements (inches vs mm) for film backs as well as where it places the center of the offsets. Nuke uses NDC coordinates (-1 < 0 < +1) where the center of frame is 0 in both x&y. Maya does not.

 

To alleviate the issue we have to do a little math inside of nuke for the camera to match perfectly.

  1. Import the camera into nuke and uncheck 'read from file'.
  2. Create a 2D position user knob called 'mayaFilmOffset' and copy the values from U and V to this new knob.
  3. Then delete the U and V keyframes.
  4. Then apply this expression to the U & V window offset values.
    • U: (2/haperture)*(mayaFilmOffset.x*25.4)
    • (((root.format.h/root.format.w)*2)/vaperture)*(mayaFilmOffset.y*25.4)

Once all that is done the camera will match perfectly to the camera that was inside of Maya!

 

spyder_f
Explorer
Explorer

Hello,

 

This solution didn't solve the problem for me. I baked the camera, baked the channels, exported and nothing. And it's almost as if it's a fake channel bake, when I turn off the "shake enabled" attribute it still actually turns it off and the shake disappears. I'm using Maya 2020. Any more ideas?

0 Likes

timdevlin.td
Observer
Observer

Hi 

 

Just to say I have values in win_translate for both U & V in nuke after exporting as alembic from Maya, using film offset expression to achive camera shake. 

 

I haven't managed to achive the second bit though for exact match.

hope that helps.

cheers

0 Likes

gdeind24
Community Visitor
Community Visitor

Yes it is possible. The solution is within maya itself.

Step. 1 - select camera go to node editor. You can see vertical and horizontal shake there. Simply break the connections and take those node in free space so we can create new setup. Now uncheck/disable shake enable in camera attribute.

 

Step. 2 - crate a group on camera so we can transfer values on rotation x and y. (Make center pivot of the group)

 

Step 3 - create multiply devide node. Connect verticalshake output to multiply devide nodes input 1x, then connect horizontalshake output to inputY.

 

Step. 4 - connect multiply devide nodes output x to camera group (which we have created) rotateX and then connect another output y to rotateY. (It will create unit coversion node automatically).

 

Step. 5 last step. To multiply camera shake till you achieve the results. Click on multiply devide node. You will see attribute where you can put value to multiply. Type values in input 2 for multiplying vertical shake and input 2 y for multiplying horizontal shake. (In my case it was x = 42 and y = -39.) Note - refer first frame too match position. You can create image sequence before doing this process so later you can match the result by applying this in image plane...... Mail me if you need any help regarding this. At gdeind24@gmail.com

 

timdevlin.td
Observer
Observer
Thank you!
I'll check this out properly sometime.
Appreciate the indeeph answer.
Best,
Tim
0 Likes