Dealing with Alembics in Houdini is, for the most part, very straightforward, but sometimes there are times in which you wanna do something very specific that you can do with zero difficulty in SOPs, and turns out that if there’s an Alembic involved, it gets trickier than it should. One of them being extracting the positions vector of cameras.
Recently I needed to do this, get the x, y, z coordinates of a camera that was part of an alembic file. Easy, just make a point with an Add SOP and reference the camera’s position using the centroid() function in HSCRIPT. Wrong.
I diged a bit around, and granted there’s (obviously) more than one way to do this, but the one I liked the most (because it’s the one that made most sense to me) was one I found on the SideFX forum, on a reply by Jonathan Mack. Full credit to him!
This method is a super easy and fancy VEX solution.
- Make a point, however you like, maybe with an add node?
- Append a Point Wrangle, and in it type the following:
Now, I made the camera string a channel so you can easily use Houdini’s interface to point to the Alembic camera you are looking for. And done! That’s all you need to do. What’s happening here with the ptransform() function is that you are grabbing the camera transforms (obscured by Alembic’s voodoo) and putting them in the current space, and for orientation, you use ntransform(), since through N you can give the point some orientation.