technical architecture.


GearVR dev batch scripts

by on Oct.27, 2015, under Batching, Oculus, Uncategorized, Unity3D

There’s a small array of .bat files that I’ve found myself accumulating over the last bit while I’ve been developing a GearVR and unity app.

A couple of the more useful scripts that tend to live in my build folder. (The ones that haven’t migrated to being editor scripts within unity that is.

Super simple one, take whatever file you drag onto the bat file in windows explorer and try and push that to the device.


adb install -r %1

Fetch the public IP of the current device that is connected via USB, turn on tcpip mode on the device, and connect to it. (While storing the last IP used in a local DeviceIP.txt file


adb shell ip addr show wlan0 | for /f "tokens=2 delims= " %%A in ('findstr /R /C:"/23"') do echo %%A > temp.txt
for /f "tokens=1 delims=//" %%F in (temp.txt) do echo %%F > DeviceIP.txt
adb tcpip 5555
for /f "tokens=1 delims= " %%p in (DeviceIP.txt) do adb connect %%p:5555

Use the last IP stored in the DeviceIP.txt file, and disconnect from remote ADB use.

for /f "tokens=1 delims= " %%p in (DeviceIP.txt) do adb disconnect %%p:5555

Clear the logcat, handy for minimizing how much log you need to scan through.

adb logcat -c

Capture/fetch the adb log to a file, log_output.txt in the same directory that you run the batch from. this will filter the log output for the standard Oculus and Unity line items only. (As of 10-2015.)

adb logcat -s "Unity","VRSVC","VRApplicationPolicy","DEBUG","OVR","TimeWarp","VrLib","VrApi","UnityPlugin","HmdSensors" > log_output.txt

remove the > log_output.txt portion at the end if you want to just draw the log to the console, which can be handy once in a while, when you want to drink from the firehose. For the extra feisty Firehose, remove the -S “” filters.

Note, if you’re trying to use any of these outside of a .bat file, and directly in the console, convert any DoublePercentages %%A to Singles %A.

Leave a Comment more...

Book report day!

by on May.25, 2012, under Uncategorized

Remember those from grade school? good times. Well, I have been doing a lot of reading in my quest to scale up my dev from the ‘hacker’ style, which has led me to quite a few books, both To-Read, and Have-Read:

Recent reads that have been helpful:

Code Complete, Steve Mconnell – I’m in the middle of this book now, It’s pretty much exactly what I’ve been looking for. Readability is high, and it is filled with practical advice and links/notes leading to further reading in any of the topics that it has touched on. I’m finding it to be helpful even with basics as I expand my vocabulary and ease some of the problems of finding random solutions online.

Head First Design Patterns – very approachable book that describes a large number of recurring problems and possible solutions to software design issues. I found the book to be quite helpful as an introduction in some cases, and as a clarification and placing some vocabulary on to some other systems that I had been working with for a while now. It also adds in some descriptions of pitfalls that I hadn’t occurred ‘in the wild’ yet. Overall, Helpful information, odd formatting, glad to have a physical copy

Coders at Work: Reflections on the Craft of Programming, Peter Seibel – The book is a series of interviews with 15 high profile/ influential programmers. I found this book extremely interesting and finished it in several days. It gives an interesting perspective on the early days of programming, computing, and a ‘hacker’ mentality.

Coder to Developer: Tools and Strategies for delivering your Software – Started well, and the book has some useful thoughts in there mixed in between the old software advice.

3D Math primer for Graphics and Game Development – I’ve found the explanations to be useful for many things in this book, it has been more a reference-when-stuck type book for me than a read-thru however. The book has been helpful, but I find myself wishing I’d gotten the Physical book instead of the Kindle version.

I’ve got a few more in the queue as ‘to be read’ mixed in with the wonderful advent of accessible free uni courses via Coursera and Udacity there’s been much learning going on of late!

Have any recommendations for me? let me know!

Leave a Comment more...

Multi-Touch and iOS/Android from the same project, Unity3D

by on Apr.06, 2012, under Uncategorized

There is a bit of a void out there in terms of recent information regarding multi touch in unity, most of the legwork of development looks to have been done in 09/10, looking around the forums there are many more questions than answers, and all out of date. SO! Lets record some of my findings from building a quick turnaround multi platform product config tool. this is the multi touch side of things, there was a slight bit more to keep it all happy with iOS/Android, but for the most part, I adopted their conventions where I could and forced the multi touch into that mold.

First interesting problem is how to begin dev and testing of a multi touch interface when you don’t have one to use! (wee!) Fortunately there is a few fun tools built by others in the CV world that can get you up and running quickly. There is much information to be had looking around in the NUIGROUP forums based around building your own touch tables. My immediate timeline didn’t let me play with full tables (sad!), fortunately Seth Sandler had put together a nice DIY project involving a webcam, some cardboard, glass, and a sheet of vellum, run on the Community Core Vision package . That got me multi touch input with output to the TUIO protocol fairly easily!

Next, looking into how to handle the TUIO inside of unity, there are a few main packages that work well, (Among others found at : I ended up with two that got serious consideration, the Mindstorm tuio, and the UniTUIO by the guys at xtuio, the code and overall base of the mindstorm system looked more solid and cohesive, but due to the schedule I ended up with the unituio for expediency sake, because it converts the TUIO touches to unitys base input system, by way of building bridged Input class and overriding the get touch functions. There is some editing needed to bring it back up to date with the 3.5 changes, but its minor and the console error log should get you there.

Now! The fun part, things are starting to work, now we can get down to biz. (Almost) There are a few other things to take into account, tuio systems are not taken into account with the built in unity gui. Alternate ui systems that work fairly easily with them are EZGUI and NGUI, I went with NGUI, and have been very happy with the support response time, and solid performance. I also adapted the truly awesome FingerGestures to use the tuio inputs, so now I’ve got a framework that works on all platforms, and with a loader for finger gestures that checks for the presence of the tuio inputs, and loads those, or else, reverts to base mouse input as needed. future: combine the two inputs so that there is no manual work on export!

One more: depending on the touch screens you’re using, you may need to convert windows 7 touches to tuio, I did this with the Touch2Tuio program. built in Windows 7 touches are functional for 1 touch, and the pinch to zoom gesture gets converted to the scroll wheel by default in unity 3.5 (And I believe it started working in 3.0 or 3.4.. the forum is vague on this.)

Performance wise, it still misses entirely too many touches for my peace of mind as a long term solution, but it worked quickly, and got us through the initial conference expo, and was a success! so work will continue, and it will get better and bigger and faster and more awesomeness. or something. I don’t know that I’d suggest this system for a long running exhibit, but it worked fine in the 3-5 day range for me.



8 Comments more...

Configurable Inverse Kinematics in unity at runtime

by on Jan.13, 2012, under Uncategorized

As demo’d in this video: OR3D tool walk thru the video is a bit on the older side, but it shows the IK fairly well.

the system is fairly simple rig that attaches as a script to the IK End Effector, and parses up the hierarchy collecting any bones that are tagged with a certain empty class (In my case called an EndJoint).

I collect bone joints at runtime after combining and configuring the hierarchy, and pass them into the CCD IK function as an array of unity transforms. the bulk of the code is taken almost directly from Jeff Lander’s game developer article describing the Cyclic Coordinate Decent (CCD) inverse kinematics algorithm, written in 1998,

the port can be downloaded from here:

3 Comments more...

python based model/texture/matlib browser

by on Jul.24, 2009, under Uncategorized

This was a learning experiment a few months back that showed some promise, and turned into a pretty useful script, I debated passing it around due to its current ‘raw’ness, but it has already been very helpful here, and I think some feedback may motivate me to tighten it up some more!

pyAssetbrowser Screenshot


Setting it up

You pick a ‘Root Directory’ by editing the settings.ini file and changing the “rootPath=X:\\Model_Library\\” to match up with your chosen path. ex: if your model library is on C:\Assets, then you will make the settings.ini file read as: “rootPath=C:\\Assets\\” every directory under this ‘root’ directory will show up in the Treeview interface on the left hand side.

(and here comes the part that made me wary of distributing it)

For the connection with 3dsmax to work, python needs to know which version of max to connect to when ‘Max.Application’ is invoked! the cleanest way to do this is to just run Adams script:, this should work for most people! the cases I’ve found where it doesn’t work, are where there are more restrictive windows user permissions, in which case it may be required to manually do this. I’ve included a couple example .reg files that can connect to max 2008 / 2009, all that’s needed to suit them to your particular installation is to edit the paths under the LocalServer32 reg key for your particular max version.

On the 3dsmax side of things, there are a couple scripts included, the script is a Struct including some simple functions for things like importing, merging, converting to vrmesh, billboarding image maps, collapsing, re-linking maps using a few stripped down bits of modified code from an older version of ColinSenner‘s Relink Bitmaps script

File Structure

for the browser to work right as is, there are a few ‘format’ type issues that are needed to make it even remotely useful.

  • To use it as a Model Library:
    • A directory that includes .Max files.
    • If there is a .JPG file with the same name as the .MAX file, then it will be displayed as the thumbnail for the item, if there is no preview jpg the maxfile will show with a 3dsmax icon.

The material library setup is kind of strange, but its modeled somewhat after easily adding items from the site, by just unzipping the library and ensuring that the directory has the same name as the thumbnail.

  • Material Library:
    • A Directory of .JPG thumbnails (Any size)
    • In the same directory, a Folder with the same name as the .JPG thumbnail
    • in the named folder (Yea, this gets a bit messy) a 3dsmax .mat material library file (Any name), and any textures required
  • Billboard/texture Library:
    • A directory of images, Most formats should work, Tiff’s wont show thumbnails due to some open source licensing silliness with PIL i believe.
    • One of the good things here, is that it can build a thumbnail list very very fast. not quite picasa fast, but far quicker than explorer does.

I’m sure there’ll be many issues, so call it a beta, and let me know if anyone has feedback!

I’m including the source also, as 90% of it is all bits and pieces of other peoples work!

A little source info

  • I compiled with python 2.5
  • the awesome ThumbnailCtrl from Andrea Gavanna
    • I did some *very* slight modifications on it to allow it to show .max files as an icon
  • used PIL 1.1.6+
  • Requires pyWin32 v212+ for the COM bridging to talk to 3dsMax
  • Interface in wxwidgets, using wxPython 2.8
  • ‘lazy’ directory treeview from here
  • exe compiled with py2exe 0.6.9

Some things that currently aren’t possible, but are obvious additions:

Multiple Root items in the treeview to allow for the fact of the various libraries to be in seperate locations/drives…

This can be done, but is a bit of a pain in the arse, how you would do it would be to create a virtual root, which is hidden (As the current root item is now) and add in your sub items below it with specific paths, the trick is just to adjust the path sent to the thumbnail control to account for the ‘virtual’ root. Not difficult, but possibly a little time consuming, so its been shelved unless someone wants to buy me a beer or two to polish it up 🙂

There is currently no way to retrieve the explorer bitmap thumbnails for .max files through python/pywin32, there is a few hints at there being possible workarounds and ideas that could work on Mark Hammond’s mailing list, but most of the talk about this is several years stale! any thoughts on this from the python heads would be more than welcome!

there are a few errors that pop up after closing but they dont affect usage currently.

3 Comments more...

When Sebbys Attack.

by on Feb.09, 2009, under Uncategorized


A shot from earlier today, I’m pretty sure there’s a few more solid ones in there, once I plow through the immense stack of fresh RAW photos clogging up my system.

On the plus side, after a few days of shooting i definitely have a much more solid grasp of ISO vs Aperture vs. Shutter, so I’m learning well why the first few days of shooting were horrifically grainy and blurry.

f5 to f11, ISO as low as it’ll go and still let me handhold the shutter speed!

Leave a Comment :, , more...

Code snippet site

by on Dec.15, 2008, under Uncategorized

Got them to add the maxscript language at the code snippet site 

a maxscript snippet:

Here’s the current list of posts tagged as maxscript, skimpy so far i know! 

the site gives us easy commenting, community editing, and an easier taggable search interface than the current state of things: cgtalk forums. I think to get wide adoption we might have to make a max or python based interface to make for easier posting/retrieval without having to use the web browser however!

We’ll see how much time i get to escape from the 4 infants to get that done ! (hah)

2 Comments :, more...

model test

by on Dec.10, 2008, under Uncategorized

Was playing around for a few minutes today with a studio setup of an old low poly model I had done for an interactive sales tool a while back. Liked the look 🙂

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!