分享： Mark Joey Tang
版本：7.0 or later，Linux, Mac, Windows
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.