in this post I will show a quick way of adding auto-focus support to Houdini camera. By setting a target, following couple lines of code will determine correct distance to focus on. This approach will work for any renderer.
The setup is pretty simple, we need to add two parameters to our camera: target which is a string pointing to OBJ node we want to focus on and dist parameter which will contain following Python expression.
After that we can link Focal Distance parameter to our dist. Feel free to drop a helper Null object for visualizing focus plane 🙂