Use it to connect and record camera movement from iOS devices and send the data to cameras in Houdini
Install HDA and libraries:
Unzip VirtuCameraHoudini-2.1.1.zip archive to any folder:
Copy 'virtucamera' and 'packages' folders to houdini18.5 user preference folder (ex. C:\Users\<user_name>\Documents\houdini18.5)
Run Houdini Python 3 version (developed and tested in Houdini Indie 18.5.582 - Python 3)
Import HDA in Houdini
(File -> Import -> Houdini digital -> Select VirtuCameraHoudini-2.1.1\otls\virtucamera.2.1.1.hdalc -> Install)
How to use:
0. Create new obj camera at scene
1. Create virtucamera node at obj context (Tab - VirtuCamera)
2. Press Open Capture Window:
Attention: Do not move Capture Window manually by mouse. Use Window position and size parameters. Change those parameters and press Open Capture Window button again to reopen window in new position and size.
Explanation: It's required because current implementation uses Screenshot method to capture video from your pc screen and send it to mobile device. Houdini need to know where Capture Window on screen to send this data to iOS device.
3. Press Run Server button
4. Open QR code or skip this step and use your_pc_ip_address:port later.
5. Install VirtuCamera app on you iOS mobile device (Tested with iPhone 11): https://apps.apple.com/us/app/virtucamera-unlimited/id1461676842 [apps.apple.com]
6. Run the VirtuCamera app
7. Connect to pc by pressing Scan QR code or connect manually by your_pc_ip_address:port
8. Choose your camera (ex. /obj/cam1)
9. Tap on black screen with eye icon to see video stream from your pc.
10. Press chain button in right top corner to calibrate mobile device and send transformation data to Houdini.
11. Look around until calibration done. Now you should see that your mobile device movements are sending to camera in Houdini.
12. Press record movement button (pure red) to start recording.
13. When the recording will be done wait a minute for plugin to put the data as keyframes on your camera.
Regarding development:
Made by using open-source API - PyVirtuCamera: https://github.com/shycats [github.com]
Feel free to modify HDA and share changes at the topic
It's required to import PyVirtuCamera python 3 libraries in Houdini to use a server functionality.
This is the main reason you need to run Houdini python 3 version.
https://github.com/shycats/PyVirtuCamera/releases [github.com]
I've already downloaded and put PyVirtuCamera-cp37-windows-x64-v2.1.1.zip to the plugins archive.
Questions for community:
1. Are there any ways to optimize python keyframes set process?
def set_camera_transform_keys(self, vcserver, camera_name, keyframes, transform_matrix_values):
""" Must set keyframes on the transform of the specified camera.
The frame numbers are provided as a tuple of floats and
the transform matrixes are provided as a tuple of tuples of 16 floats
with 4x4 transform matrixes, with a matrix for every keyframe.
The first element of the 'keyframes' tuple corresponds to the first
element of the 'transform_matrix_values' tuple, the second to the second,
and so on.
* The up axis is Y+
* The order is:
(rxx, rxy, rxz, 0,
ryx, ryy, ryz, 0,
rzx, rzy, rzz, 0,
tx, ty, tz, 1)
Being 'r' rotation and 't' translation,
Is your responsability to rotate or transpose the matrixes if needed,
most 3D softwares offer fast APIs to do so.
Parameters
----------
vcserver : virtucamera.VCServer object
Instance of virtucamera.VCServer calling this method.
camera_name : str
Name of the camera to set the keyframes to.
keyframes : tuple of floats
Frame numbers to create the keyframes on.
transform_matrix_values : tuple of tuples of 16 floats
transformation matrixes to be set as keyframes on the camera 'camera_name'
"""
camera_node = hou.node(camera_name) #Get camera node
for x in range(len(keyframes)):
key = hou.Keyframe()
key.setFrame(keyframes[x])
matrix = hou.Matrix4(transform_matrix_values[x]) #Convert tuple to matrix4 format
translation = matrix.extractTranslates('srt')
rotation = matrix.extractRotates('srt')
key.setValue(translation[0])
camera_node.parm('tx').setKeyframe(key)
key.setValue(translation[1])
camera_node.parm('ty').setKeyframe(key)
key.setValue(translation[2])
camera_node.parm('tz').setKeyframe(key)
key.setValue(rotation[0])
camera_node.parm('rx').setKeyframe(key)
key.setValue(rotation[1])
camera_node.parm('ry').setKeyframe(key)
key.setValue(rotation[2])
camera_node.parm('rz').setKeyframe(key)
2. Are there any ways to capture pixel buffer from scene viewer? I would like to know, because screenshot capturing is slow and not cool, but it works