Jump to content

Motion Vector pass ?


kensonuken

Recommended Posts

I assume you are talking about a RGB pass that captures the displacement of the object from the previous frame to the current?

I don't think you can calculate that directly inside the shader, i think what you need to do is pre-calculate the object motion and then store that as a point attribute.(in other words find the position of the point on the previous frame and subtract it from the position of the point on the current frame)

Then inside the shader you have to do a lookup and get the motion value for the current pixel from the point attribute.

Link to comment
Share on other sites

yeah i understand and thats what Im talking about... there are certain offshelf systems with ready shaders available.... but I want that one to convert it to Vex and as well as I dont know how to reconvert it in the compositing package...

can anybody explain how is that possible?

is it just the directional blur? if so then what about curvature situation...?

Link to comment
Share on other sites

Well i don't know how the compositing package will handle motion blur i think it will take up to X amount of velocity passes(and other passes) and then composite those together.

As far as explaining how to make such a shader i can't give you specific directions simply because i wrecked my version of houdini and i have to do a reinstall.

But i can give you a approximation of how i would do it.

First i would put down a point sop and press the ? button.

Then i remember that there was a expression to get the point position of the previeus frame.

Then i would put down a attribute sop node and set it to type: vector.

Then i would say posX - posX2 (posX2 previous frame).

do the same thing for Y Z.

Create a new vop surface shader.

And within the shader put down a parameter node and then request the attribute you just made with you sop attribute node.

then i would pipe that value into the color out.

now if the velocity in any direction surpasses 1 then the data will be clipped.

So the best thing to do would be to set a limit that you will never surpass.

Link to comment
Share on other sites

Generating motion vectors from mantra so that motion blur can be done in post. Two separate things have to be done for this to be possible

1. In a shader, use the getblurP() function to compute velocity. This will capture deformation, transformation, basically, all types of motion on the surface.

  surface motionVector(export vector velocity=0)
  {
	  // Compute velocity
	  velocity = getblurP(1) - getblurP(0);
  }

2. Enable motion blur then ensure that the "imageblur" rendering property is turned off in the output driver. This prevents mantra from doing the blur itself. You have to add the Image Blur property to the Output Driver.

I attached a hip file that shows you how to set this up. It shows both transformation and deformation motion blur.

You can copy-paste the network box "motion_vector_vExport" from the surface shader vop net in /obj/sphere_object/shopnet1/basic_surface in to your vop own shader and then pick up the "vExport" export variable in the Mantra output driver's extra image planes section.

bake_motion_vectors_aov.hip

Link to comment
Share on other sites

  • 1 year later...

Generating motion vectors from mantra so that motion blur can be done in post. Two separate things have to be done for this to be possible

1. In a shader, use the getblurP() function to compute velocity. This will capture deformation, transformation, basically, all types of motion on the surface.

  surface motionVector(export vector velocity=0)
  {
	  // Compute velocity
	  velocity = getblurP(1) - getblurP(0);
  }

2. Enable motion blur then ensure that the "imageblur" rendering property is turned off in the output driver. This prevents mantra from doing the blur itself. You have to add the Image Blur property to the Output Driver.

I attached a hip file that shows you how to set this up. It shows both transformation and deformation motion blur.

You can copy-paste the network box "motion_vector_vExport" from the surface shader vop net in /obj/sphere_object/shopnet1/basic_surface in to your vop own shader and then pick up the "vExport" export variable in the Mantra output driver's extra image planes section.

bake_motion_vectors_aov.hip

This treath havn't had any activitie for quit a wile now.

I wonder, why are there two getBlur() nodes needed. One with 1 time input and one with a 0 time input. Which got subtrackted at the and?

I've exported them seperatly, and they seem to be exactly the same.

I would like to ubderstand how the getblur node does his thing, since the docs are missing..

Edited by Nerox
Link to comment
Share on other sites

  • 3 weeks later...

 surface motionVector(export vector velocity=0)
  {
          // Compute velocity
          velocity = getblurP(1) - getblurP(0);
  }

So I copy and paste the code from "bake_motion_vectors_aov.hip" to my .hip. But it do not work.

Strangely it works inside "bake_motion_vectors_aov.hip". So I'm guessing that I'm loosing some parameter.

Any idea?

bake_motion_vectors_aov.hip

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...