SceneDepthCalculator v1.2

This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Mark Joey Tang
Calculate the depth distance between animated or non-animated axis/geo and camera. It is useful for any depth setup and make it automatic, such as creating rack focus, DOF on moving object, DeepCrop, create holdout in Deep, clip zdepth pass, analyze the depth for the shot to drive any 2D setup in template, etc.
Requirements:
7.0 or later
Linux, Mac, Windows
11 May 2018
96

Calculate the depth distance between animated or non-animated axis/geo and camera. It is useful for any depth setup and make it automatic, such as creating rack focus, DOF on moving object, DeepCrop, create holdout in Deep, clip zdepth pass, analyze the depth for the shot to drive any 2D setup in template, etc.

===============================================

Changelog:

1.2

- fix the code of reverse 'rotate order'

*currently only work with both input connect

to single camera and geo nodes directly, next

version will get it works better. Please use

'Unify3DCoordinate' to combine the

transformation from the stack nodes.

http://www.nukepedia.com/gizmos/3d/unify3dcoordinate

1.1

- fixed the bug with offset back to zero and 'Output Depth' remain the expression.

1.0

- use geo and camera to calculate the depth. Useful for depth of field, deep compositing, clip zdepth, 3D scale on 2D nodes and any zdepth related compositing method.

===============================================

I used a similar tool before and that's using the equation of 'sqrt(pow(x1-x2)+pow(y1-y2)+pow(z1-z))' to measure the distance, but I found that is not working properly if we need to measure  the pov of the camera to the target point. If the target moved away from center on the same depth, the value not keep the same distance because of above equation is a point-to-point measurement. And it always return a positive value even the object goes behind the camera. So I made this tools to get the accurate camera depth measurement. This tool is using matrix calculation to convert the distance in Z of the camera.

Use axis/geo to place the target point in the scene for the depth calculation. It is not necessary to be center of the camera, just place it on the target object. The axis/geo can be animated or non-animated.

The value will return precise measurement when the camera and target geo animated in frames.

The return value is a direct depth value (1/z), so it can be use under any deep compositing. For example, when the shot has camera track in, the deepCrop can be stay at the same cropped area on every frame.

If there has any moving character/object in the shot and they need to stay in focus, the output value can be linked to focal plane to keep them always in focus.

Deep data is same as depth data, so the value can be work with zdepth pass. Keep in mind that the deep and this tool is using 1/z for the depth data, but depth pass from scanline is 1/Z. So if using the depth pass from 1/Z, you have to convert the value on either one.

I also have a little trick to use this tool. It can also be used on template setup, from a keyshot to get the scene size ratio applied on any 2D nodes. So when it updated the camera on the other shot in the same environment, the ratio on any 2D node will return the correct value from keyshot. And keep all the shots in the same evironment, same setting and same outcome.