Where is Vector Pass calculated?

I require a 3D velocity vector pass. Cycles’ Vector pass is 2D. I need to find where it’s calculated so I can write a 3D version.

Leads:

I found this within the first ten minutes of searching. All common sense points to this being the function I’m looking for, but none of the breakpoints I set here ever trigger. Nor does having this function return zeroes alter the Vector pass output at all.

After that, I found where the Vector pass buffer is filled. Setting lines 420-423 to zero makes the Vector pass all black; setting those lines to 1 makes the Vector pass all white. The problem: I can’t trace this path upstream to find what loads the buffer. In addition, I found where the Vector pass is tagged to update[1], but I can’t find where it actually updates.

I found someone else with a similar question[2], but their findings didn’t point me anywhere new.

1) https://github.com/blender/blender/blob/master/intern/cycles/render/film.cpp#L599
2) https://devtalk.blender.org/t/output-result-of-individual-passes-in-cycles-standalone/200

Am I missing something right under my nose? Thanks for your time!

Hi bro, have you solved this issue yet? I am also blocked by this. Would you please share your solution?