Just a guy, drifting.
Houdini And 3DConnexion Devices
Yes – I have something working! Read on for the story and where I’m at:
I’ve noticed a problem with a lot of animated shorts and student work: The camera work is atrocious. It seems like all the time is spent on perfecting the modeling, animation, and shading, then in the last 10 minutes of production someone puts in a camera and animates it going to the left. Seeing this as a major issue I thought that there must be a better way to have the camera animated easily and a whole lot better. I then recalled I had a 3DConnexion SpaceNavigator that I never use because no applications I use support it. The whole line of 3DConnexion devices might be just what animators need to have better control of their camera.
The SpaceNavigator seems ideally suited to be able to control not just a camera but any object in 3 dimensions, provided that the application can see and understand the device. Unfortunately, Houdini is not one of them. So I researched it a bit and found some hope in an obscure post on the 3DConnexion forum. Someone had been able to use Python to poll data from a device using a Python module called comtypes, a COM client framework (the Windows SDK for the device is a COM dll). I tried it in Python 2.5.4 and it worked! At the time it seemed like a simple thing to add the script in Houdini and replace the trans and rotate prints to “hou.node(‘/obj/cam1′).parm(‘my param’).set(my devices param)” and get the camera to receive data from the device. Long story short – it didn’t work. Firstly, Houdini doesn’t have _ctypes.pyd which is required by the ctypes module (so I added it to Houdini x.x.x\python\lib\ which worked). Secondly, though it seemed that the device driver was being seen, an error kept posting.
So more research was needed. I thought maybe using the old comtypes (v 0.2.1) with the script from the 3DConnection post was the issue, so I upgraded to comtypes 0.6.0. But if you read the post, only 0.2.1 works with the script. More research… then after getting the script to work with 0.6.0, I still got the same error.
So off to odforce I went (to cry for help) which got me thinking more but all of those avenues were dead ends. Then – you guessed it – more research. Which lead me to figure out what was wrong. My comtypes module in Houdini wasn’t compiled! I had no .pyc or .pyo files anywhere! And that was it, after I compiled everything using the Python compileall module in Houdini itself it all worked out. Now I can get Houdini’s command window to print the data from the device just fine. The next step is to see if it’s feasible to get this data into Houdini beyond printing to a window, but that is for another day (and another post) mainly because some quick tests cause Houdini to freeze up when I try to use the data to send to a parameter.
Here’s a quick look:
Houdini Using A 3DConnexion Device Via Python from Geneome on Vimeo.
There are some 32/64-bit issues. The _ctypes.pyd that comes with Python only seems to be compiled for 32-bit machines. So unless I compile my own 64-bit _cytpes.pyd, this only works with a 32-bit Houdini. You can use a 64 bit _ctypes, which works with Houdini 10 64 bit but you need to use a different ctypes module version (1.0.2). As we are using a COM dll to poll data, this is a Windows only method. I need to look at the 3DConnexion SDK for Linux to see if Linux is in the cards through this or some other method.
(See the follow-up here.)
| Print article | This entry was posted by Eugene on April 11, 2009 at 11:31 pm, and is filed under Houdini, Video Demos. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
VOP COP Raster Depths
about 10 months ago - No comments
This was an odd video to do since it seems to be a simple topic but when talking about it out loud it starts sounding complicated. I’m basically covering several sub-topics which support the overall topic. Despite the confusing ramblings in the video, what you should take away from it is that in VOP COPs,
Sprites On Points Digital Assest
about 1 year ago - No comments
Sprites are pretty cool, but in a clean install of Houdini you can only use them on particles using the Sprite POP. It turns out, you can add some attribute trickery to make sprites work on plain ol’ points. The cooler thing is that this Sprite SOP concept works in Houdini Escape (which doesn’t have
Varying Materials Using A Single Shader
about 1 year ago - 2 comments
Nothing ground breaking here, but for someone who is into neat little tricks to control shaders, I thought this was worth showing. What the video covers is a way to vary the materials on a single object using a single shader (differing from the usual method of using multiple shaders for different pieces of an
Houdini Python COM Conclusion
about 1 year ago - 1 comment
After getting something working, and continuing off and on with trying to get it to work, I have come to develop some concepts about using a Python COM method to poll 3DConnexion data. The operators at the geometry level (the Python operator and Script SOP) are unable to poll the data. This seems to be
Houdini Occlusion Asset
about 1 year ago - No comments
I’ve received a few requests for an asset of the occlusion inline VOP I used for the occlusion video so I thought I would put one together. I call it “Occlusion 2″ mainly because it’s the second occlusion VEX function. The occlusion VOP that comes with Houdini is actually the first function which gives you
Houdini BRDF Asset
about 1 year ago - No comments
I’m not sure why illuminance loops fascinate me so. It could be because I never had access to such a cool feature or maybe it leads me to re-visit classic bi-directional reflectance functions (I like the math). Whatever the reason, I decided to create a brdf VOP digital asset so you don’t need to type
Image Planes Part 4 (Object IDs)
about 1 year ago - 2 comments
Didn’t think the image plane series was complete enough so I tacked on this little diddy. I covers how to get object (or primitive) ids using image planes in Houdini and what you can do with them in the compositor using the lumakey COP. The compositor part I learned from SYmek, who I feel is
Image Planes Part 3 (Light Export)
about 1 year ago - No comments
I’m fairly pleased with this video only because I learned a lot on my way to get this worked out. Well, I learned a lot of mistakes one could make with Houdini’s VEX like what you shouldn’t put in illuminance loops. I felt obliged to do this video since in the very first video I




WotC Community Page
about 1 year ago
Cool, i would love to be able to use something like this to control viewports.
on a related note i thought you might find this interesting, someone took a Wii-mote and wired the sensor into their pc and they are using it to modify parameters to drive a car around inside the Houdini viewport:
http://www.youtube.com/watch?v=pZthjZIroW8
pretty cool actually, and kinda related to what you are trying to do, so i though i would share
about 1 year ago
failure? i don’t think so!
following up on what Mr. Bleh pointed out, have you tried to get the data into CHOPs first and then reference from there? is that stable? can you have 2 Mouse CHOPs?
are you able to get any info on why it’s crashing? can you spit out a text file or echo to the console before assigning values to params? you’d have to figure out how to launch H from the cmd line in Windows. cygwin?
does your method allow you to test other devices like a mouse? does it crash? can you incorporate that HID stuff? what about pygame?
first i thought you were getting bad data, but now i’m thinking that maybe depending on context you’re polling too often and not allowing H to do other tasks. possible? just guessing here.
if i sit starring at this text any longer i’ll come up w/ completely opposite ideas… like maybe the polling process is too slow for the param to use it? hopefully fixed by going to CHOPs first, yes?
whatever it is, you must be really really close. you just need to find the invisible door. ;o)
good luck. peace, “Use the force, Luke.” & 42
about 1 year ago
That car thing is very cool! It happened a while back too. His use of chops seems ideal and maybe it’s worth exploring for my 3DConnexion script.
about 1 year ago
I haven’t been able to get an error log from Houdini (because I’ve never looked), but I haven’t run the assignment of parameters in the command line of Houdini to see if the same thing happens. The idea of mapping the 3DConnexion device to a mouse output then to a mouse chop might just be the key.
Not sure if polling too often is causing the issue, but it could be assigning a value directly to a parameter too often might be the issue. Maybe sending the info to chops would resolve this issue. Definitely need to test this.
BTW, did you notice one of the comments on this video mentioned my site? Very cool!