What's happening now at Because We Can

Old Dogs, Old Tricks: Running Blender (or anything else) via X11 over SSH... Work from anywhere / any OS!

OK. I'm a big ol' Geek.
There.
I said it.
Anyways, here's a new trick I learned that's going to be very useful in the future. It's something all my Unix-God-Sysadmin friends chuckle at my excitement over (for they have been doing stuff like this for a very long time), but it's also something a lot of non-Unix-Gods don't know anything about. Also, seeing that the 80's are back, and that this was invented then, I figure it will be hip to bring it up again, retro-style, like wearing a bad t-shirt and listening to Old New Wave.
It's running things remotely via X11/OpenGL & SSH. What this means is that, in my case, I can run Blender, but have all the number-crunching-rendering happening on one computer (a cheap tower sitting under a desk) but yet have all the OpenGL-GUI-mousing happening on another (my laptop, which in this case doesn't even need to have Blender loaded on it).
This is a lot like Microsoft's Remote Desktop, however, instead of the whole desktop being shared, it's just the application window you're running remotely. And it also works on almost any computer. And it can be a lot faster than Remote Desktop or VNC, for the window-drawing effort is happening on the local computer, instead of on the remote and an image of its desktop being sent over the Internet (and constantly refreshed) instead. Oh, and it's Free, which rocks.
So, in my Blender Example, when the OpenGL interface hits my laptop, my laptop's graphics card is doing all the work to draw the GUI, and the only thing that's passing back and forth along the Internet are the GUI's system calls back to Blender, which is actually running on the other computer altogether (again, it doesn't even need to be loaded onto my local machine).
So, in other words, it's real snappy on my end, but when I hit Render my CPU meter doesn't even spike, for the remote computer is doing the number-crunching for me (so it's double-snappy).

The X11 is the part that allows these application windows to be drawn remotely, and the SSH is the part that allows you to do it over the Internet from anywhere.

OK, so the how-to-do-this part:
First off: You'll need something that can run X11 on both ends. In my case, that's Cygwin on a Windows laptop (the local), and OS X or Ubuntu Linux on the server (the remote). If you're using Cygwin, you'll need to tell it to install X11 & OpenGL. If you're using an older version of OS X, you'll have to install X11 onto it (I think 10.3 and up have it built-in). I'm not going to talk too much about this here, for this isn't something that's too hard to get going. Most all flavors of Linux have X11 already installed (it's what Gnome/KDE/whatever use).
Second Off: Once you've got X11 on the local and remote machines, you'll also need to get SSH on both. It's built-in within OS X, but you'll need to install it on some Linux flavors and within Cygwin, too, if I remember correctly.
Third Off: You'll need some way for the two machines to find and talk to each other. You'll need the Remote machine's IP address and/or name (if you've got some kinda name server thing). You'll also need to make certain that port 22 (or whatever port you're going to use for SSH, 22 is the default) is open and not blocked by a firewall. Finally, you'll obviously need a login on the remote machine as well.
Fourth Off: Test your X11, make certain it works locally, and then test your SSH, and make certain you can talk with the remote machine just via a simple command line.
Fifth Off: OK, now's the only somewhat-tricky part. You'll need to edit your SSH configuration files to tell it to allow X11 forwarding on the remote machine. You'll need to find a file called 'sshd_config'. It's usually within /ECT/SSH/, however to keep things fun and interesting different folks put it in different places. Simply add these lines somewhere within it:
X11Forwarding yes
X11DisplayOffset 10
These tell it that it's OK for the SSH Daemon running on the server to forward the requested X11 windows out over SSH (duh) but I'm too stupid to know what the 'X11DisplayOffset 10' line is for...
Sixth Off (and we're on!): OK, now's the not-tricky-at-all-part. Fire up whatever runs X11 for ya (in my case, that's going into Cygwin and typing 'startx'), and run a new xterm by cleverly typing in 'xterm'. This is an X11 shell, and it should open up a new window. Now, type in 'ssh  -Y your_login@your_remote' (obviously, put in your login and your remote's IP/server name in there instead, and make certain that's an uppercase Y in there, for that puts it into a trusted mode that makes this work). Type in your password to your account on the remote machine, and hit enter. You should be presented with a simple command prompt on the remote machine. Let's test that it's working, so type in 'xclock' and hit enter. You should see a window pop-up with a clock within it (ooooh!). Now, simply run any normal command that uses a GUI by typing in it's name (ala 'blender' in my case) and lo and behold it's window will pop up on your local machine, but the program will be running on the remote machine. Welcome to the 1980's!

Now, why would you ever want to do this? Well, you can use this to easily slave any number of machines running Blender to your work desktop, send them into Rendering jobs, check on their progress easily, see the visual end result, and Get More Done from the comfort of anywhere with a fast Internet connection...
You can also use it to see the results of various X11-window-generating Radiance commands, like doing a test RAD, or viewing a Radiance picture...
You can use it to run software (like Radiance) that's only available for Unix-based systems from offa a Windows machine, but get to use your mouse and a GUI...
You can use it to run software that you're not allowed or don't want  to run locally due to your workplace, ala remote web-browsing, IM'ing, and the like...

Shopbot Acquired. Bonus x1000.

Hooray! We are the proud soon-to-be-owners of a PRT96 Shopbot!
A 'Shopbot' is a entry-grade CNC routing table, 4' x 8' x 6". It Cuts Things. Anything non-ferris, more or less.
It's got a great company and a great group of users behind it. We were able to score a cheap-but-new 'PRT' model vs. the newer, faster, better and more expensive 'PRTalpha' due to a special deal they have right now, due to having lots of left-over PRT motors left over from folks upgrading to the PRTalpha motors instead. So ours will be slower and less accurate, but since we're not a production shop (yet) I don't think it's an issue, and if it becomes one we can always upgrade later too. All told, we're under $7K, which is about half the cost of a new 'normal' CNC table out there...
This is a very exciting day, something we've been working towards for a long time now. Honestly, ever since I was a little kid, I've always thought of just having a Robot that would Make Stuff based upon what I drew, and, when older, and using 3D software (and later Revit) just wished that I could just go from the model directly to fabrication, instead of all the tedious documentation and inaccurate power tools...
We've got big plans for this machine. Furniture, Products, and someday maybe whole Buildings. From computer model to real-world model, baby! woot!
I knew that my becoming a big ol' Revit dork would pay off someday...
So... once we figure out how to make the Shopbot make another Shopbot, we'll TAKE OVER THE WORLD! Ahahaha!

Pages

Subscribe to RSS - blogs