Tuesday, 11 March 2008

Better motion vector blur out of Nuke's Scanline renderer

Look at the following gif animation:

Do you think you can get that out of Nuke's scanline renderer without cranking up the multisamples but only with vector blurs?
It's not as easy as it seems.

To get accurate motion blur where an object changes direction, like you see in the example, you need forward and backward motion vectors.
The scanline renderer unfortunately outputs only one of them. You get forward motion vectors by setting the shutter offset to 0. You get backward motion vectors by setting the shutter offset to -shutter/2.
The effect of the shutter offset setting is very confusing when you output motion vectors.
From my technical understanding such a setting should actually only shift the point in time forwards and backwards from which the motion vectors are calculated.

The Scanline renderer definitely should have seperate controls to output both forward and backward motion vectors.

So how do you get both? Unfortunately at the moment it seems that you need two scanline render nodes and two vector blur nodes. Which means unfortunately doubling the render time. But that's still faster than cranking up those multisamples.
Take a look at the following setup:

That's the setup i use to create vector motion blur from 3D.
You have two branches.
The one on the left is for backward motion blur. The one on the right is for forward motion blur.
At the end i mix both results with a dissolve which functions as a shutter offset.
The multiply setting in the vector blurs is linked via an expression to the dissolve settings.
One could also add another variable to the multiply settings expression to scale them. That variable would then function as a shutter angle setting.

Feel like creating your own vector motion blur gizmo or even creating your own scanline renderer gizmo now that incorporates all this stuff?
I was lazy till now. But will sure build my own soon. :)

Btw in Nuke 4.8 you could do the same with the motion vectors generated from 2d transformations by setting the shutter offset in the MotionBlur2D node to 0 and -shutter/4 (a bit confusing eh).
In Nuke 5 it seems to be crippled and can only output forward motion vectors (boo!).
Although for 2D transformations you have of course the nice timeblur where cranking the divisions up is not as time expensive as Multisamples in 3D.

As a whole i think the motion vector generation in Nuke 5 is inconsistent and confusing. I hope the Foundry changes that.


And in the case that i'm overcomplicating things and this is all obsolete please let me know.