How to have a render pass for camera coordinates pass to compositor?

Hey, I just want the camera coordinate in compositor for render layer in Blender 2.82.

Since in blender 2.82, we can use custom AOV to make our own render pass, so I create one which names XY to be a render pass for camera coordinates in the world material, here is the shader nodes.

And what I got seems not what I want, because the cube part is transparent which means it does not contains camera coordinates. see screenshot below.

So my question is: How to get the whole render pass which store the camera coordinates? Or If there is any way to get the 2D xy coordinates in render layer in compositor so that I don’t need to make my own render pass to achieve this purpose?

Shader AOV outputs are typically for getting extra shader information rather than entire scene data passes. They only apply to the materials they’re present on. Using them in the world material will only apply to visible parts of the world.

For custom AOV output, you should use a separate view layer with a material override. For data output you’ll also want to heavily reduce the sample count of the new view layer to prevent anti-aliasing.

Something like this is probably what you want:
camera_pass

1 Like

Thank you, I used your nodes for my material (And override to this material for the entire view layer). And it seems works perfectly.

Here is the screen shot with a cube and a sphere, and the entire view layer is the data (2d camera coordinate), that is want I want.