Jump to content

Motion vector from Camera?


Recommended Posts

I'm trying to generate a motion vector pass for use in Nuke later.

 

The way I've usually done it is like this, inside a shader:

http://imgur.com/tSbatjM

 

Well that's not working now, and strangely if I set all the motion blur settings to

0 but I enable motion blur I still get motion blur.

http://imgur.com/7htfLLi

 

When I change the shutter time setting on the camera in the scene, that seems to be influencing the motion blur.

http://imgur.com/gNgKfru

 

 

Is there any way I can extract a useable motion vector pass for Nuke from what the camera is seeing, or am I going about this all wrong?

 

Link to comment
Share on other sites

Hey Petur,

 

Sorry for the late reply, hopefully this didn't cause you too much trouble, but for anyone out there looking for this solution here it is.

 

Petur your setup is very close. What is different to my setup is I never source the P (position) attribute into my motion vector from the globals. You need two 'getPBlur' nodes. Their input values for the time input are 0 and 1 (t0 and t1 respectively). t0 represents the position are the beginning of frame and t1 is the position at the end of frame. 

 

Next we should normalize the positions into the screen space using the toNDC node. Next we get the difference between the two position values (t1-t0).

 

Finally, its a good idea to make the value represent pixel movement so multiple the position vector by the resolution of the camera (1920, 1080, 0). Export this out with a bind. I call my export attribute vel usually. Depending on the MotionVector tool you may need to remap the vectors further (i.e. RSMB uses 0-1 space and 0.5 is not moving.)

 

 

Mantra Notes:

 

1.Make sure allow motion blur is turned on.

2.Turn off Allow Image Motion Blur.

3. For objects using velocity make sure to turn on 

 

 

Hip File is attached.

 

 

MotionBlurFun.hip

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...