I have a maybe tricky question to solve. Maybe it's not tricky at all and there is a simple solution that I don't know.
I have a geo that randomly changes its x and y size indepentendly. Now my problem is that I want to fit the field of view to those changes by moving the camera (non orthographic) back and forth (just on one axis). In general it is easy to just calculate it if the size change is only in one direction like this:
To give you a little update on the problem solving:
Its not solved but by calculating the diagonal value of the boundingbox of the final object as the object size helped. It somehow works because both x and y are affecting the length of the diagonal but its not precise at all and more a workaround…
You just have to calculate distance twice, once for the x axis, and again for the y axis, and use the larger of the 2 distance values. Don't forget that filmsize is different along the x and the y axes.
ziconic You just have to calculate distance twice, once for the x axis, and again for the y axis, and use the larger of the 2 distance values. Don't forget that filmsize is different along the x and the y axes.
Yes definitely I am having that in mind I just didn't know how to compare the two values and also just took the filmsize Y value which returns a not very accurate result as its just accurate for the size y of the object. (now that I think about it the correct way would've been to also take the diagonal of the filmsize to make it more accurate). So the diagonal way is the cheap workaround.
But the solution to compare the two values would definitely be the way to go. How would I do that?
One way is to control the camera position using a Python expression that takes into account the bounding box of your geometry. See my hip file for an example for how this can be done.
Oh amazing thanks a lot for the effort ziconic! But it seems I am missing something… how solve that? I honestly have never implemented python in Houdini..
Try this version, which avoids using the missing Python API.
(Also I found another weird quirk with the original file I posted. Opening a hip file where an object node has a script that sets its own position but is parented to an object node with child compensation enabled can cause a pre-transform to be added to the child node. I should probably file this as a bug.)
ziconic Try this version, which avoids using the missing Python API.
(Also I found another weird quirk with the original file I posted. Opening a hip file where an object node has a script that sets its own position but is parented to an object node with child compensation enabled can cause a pre-transform to be added to the child node. I should probably file this as a bug.)
Hey all,
coming back to this one once again. I'm still trying to make this work.
I would still like to find a way to control two things... and I don't seem to find a solution for this. Sometimes the framing is not right (the object is sometimes too far away). That somehow happens when the calculated boundingbox has one very long and one short edge. Maybe it would be possible to find a solution to define a maximum and minimum edge on both the top and the sides of the framing.
Would be super happy if someone has an idea for this.