Houdini Focus Distance causing camera jitter (32 bit limit?)

   1471   2   1
User Avatar
Member
17 posts
Joined: Feb. 2019
Offline
Hello! We are running into an interesting predicament. Currently we are using a focus null to automatically calculate the focus distance on cameras using this expression: vlength(vtorigin(".","../FOCUS"))

We are working at relatively small scale (ie focusing a few centimeters from the camera). I believe the jitter is being caused from hitting the 32bit limit of the focus distance - I'm not sure how focus distance works relative to the rotation and translation of the camera but it seems to affect it for some reason. I was curious if anyone has a solution for this - if it's possible to leverage the 64bit features of Houdini, or if we just need to scale all of our scenes by 10 or 100x. Cheers!
User Avatar
Member
292 posts
Joined: July 2013
Offline
As far as I know everything is 64 bit floating points all over the place and the focus distance is also not connected to the transform so I suspect something else is happening. Do you actually see the camera jitter in viewport or only in renders?
More code, less clicks.
User Avatar
Member
8173 posts
Joined: Sept. 2011
Online
Does it jitter if you kill the expression on the focal length, or disable depth of field? The scale should be irrelevant for precision issues, the issue is being far from the origin relative to the size of things. You say you're working with cm scales, but are you kilometers from the origin? I would try to build any scene such that the camera is always a small multiple of the size of the subject from the origin.

frame_48
vlength(vtorigin(".","../FOCUS"))

I think this is the wrong expression for focal distance. This will get you distance to the null, which if the null is not in the center of the image would be incorrect for focal distance. I usually use sops to tranform the point into the camera's space and then get the z component of the point in camera space. The equivalent expression would be -vtorigin(".", "../null1")[2]which gets the z component of the position of the null relative to the camera.
Edited by jsmack - Oct. 12, 2023 11:00:42
  • Quick Links