Two Good Books for an Intro to Quaternions

Here’s a good intro tutorial on Quaternions for Unity3D from Unity Gems. It comes w/ a sample .unitypackage.

For a more in depth understanding, the following two books might help.

I liked the Quaternions section in the 1st edition because it gave you more context by going over Complex Numbers and performing addition, subtraction, multiplication on them first:

3D Math Primer for Graphics and Game Development
By Fletcher Dunn and Ian Parberry
Jones & Bartlett Learning

I’ve looked at the 1st edition of this book for an overview of Quaternions and it was fairly straight forward but no overview of Complex Numbers:

Essential Mathematics for Games and Interactive Applications: A Programmer’s Guide
By James M. Van Verth, Lars M. Bishop
CRC Press (Taylor & Francis US)

Encouraging Stats for Unity3D as a Mobile Games Dev Platform but There’s Still a Reality Check for Non-Indie Developers

Interesting statistics from Game Developer magazine (May 2012), via Gamasutra:

…Game Developer magazine has released the results of its first-ever mobile and social developer technology survey in the May 2012 issue….

Unity topped the list of mobile game engines, with 53.1% of developers reporting using Unity compared to 39.8% using a custom engine., 17.7% using Cocos2D, 5.3% using Marmalade, and 5.3% using Corona (this question wasn’t exclusive, so the percentage count adds up to more than 100%).

I’m guessing most of the 53% are indie developers for now.

At the moment (Fri, Aug 24, 2012), I did a search for “Unity3D” on in all of the US, and got less than 100 job postings, many of them only mentioned Unity3D as a “nice to have”. Compared that with 8,828 jobs that mention HTML5, 12,567 for Flash (yes, still!), 2,087 for Actionscript (even after “Flash found dead in seedy San Jose motel room“) on the same date in all of the US.

I hope more Tech Directors & teams hear about Unity soon & pick it as their dev tool for mobile games & beyond. I like working in this game engine, so it’d be nice to have more job opportunities for it in more places.

Unity3D for iOS: AR Flyer/Poster Example with Basic Sound Spectrum Analyzer

Here’s a quick Unity3D Augmented Reality example I made this week using Qualcomm’s free Vuforia for iOS plugin.

In addition to Vuforia, I used the handy open source iTween library & Unity’s AudioListener.GetSpectrumData on a dummy model I made using Blender. The 3 robots are acting as the sound spectrum analyzer, each being tweened in response to a float (decimal) that’s put together from an average from a sound frequency range.

I used a Creative Commons graffiti image from Flickr in the flyer/poster background & a Creative Commons mp3 from SoundCloud.

In this case the entire flyer/poster acts as the Image Target. I was surprised to see that it got a 5 star rating in the Target Management System (TMS) on QDevNet (TMS shows up under My Trackables after you create an account).

Random Notes to Self on Using Blender for Unity3D

Armature, Error: “Bone heat weighting: failed to find solution for one or more bones”

  • Blender-Fixing Automatic Weight Errors – a Blender 2.6 video tutorial that addresses some of the things that might be wrong. Remove Doubles, Recalculate Normals, etc.
  • Super basic video on adding Armature. More detailed rigging How To video.

Armature, Weight Painting

  • After you get Bone heat weighting to automatically assign your armature to the body, you can get more precise results via Weight Painting. In Weight Painting Mode you can edit exactly which part of a mesh is controlled by each bone.
  • Weight Painting A Human Mesh. (blender 2.6 onward)

Having fun with some basic armature for this thing:

Animating in Blender and Importing into Unity in FBX format

  • Some tutorials on using 1 long animation timeline w/ keyframes & checking Split Animations in the Unity Inspector for the model’s FBXImporter settings: one, two

UV Mapping & Textures

  • Create seems: select Edges you want as seems in Edit Mode, hit Ctrl+E for Edges menu & choose Mark Seem. Then, in Edit Mode, hit “U” to pull up the UV Mapping menu and choose Unwrap. A good overview using a pyramid shape here, around 11:00 in the time code.
  • JPGs seem less quirky than 24-bit PNGs in the UV/Image Editor in Blender 2.6. To get the transparency in the PNG to show up properly, it seems like you need to check the Premultiply checkbox in the Image section of the hide-able submenu on the left side of the UV/Image Editor (the + in the upper left corner).

To reset Scale of an object to (1,1,1) after scaling it in Object Mode (necessary for Unity3D import)

  • in Object Mode, hit Ctrl + A
  • choose Scale
  • Or, go to Object > Apply > Scale in the 3D View
  • This is important when using Blender to build models for import to Unity3D. If your model’s Scale isn’t set to x:1, y:1, z:1 your Unity project will suffer from performance issues.

To SEPARATE two meshes or to separate a face from a larger mesh

  • in Edit Mode, hit P
  • useful when trying to use a Loop Cut (Ctrl R) on just 1 face of a large mesh

To JOIN two meshes or to join 1 face with a larger mesh

  • in Object Mode, hit Ctrl + J

To extrude a vertex or edge

  • in Edit Mode, select the vertex or edge, hold Ctrl and pull on the selected vertex or edge, use the XYZ arrows for precision

Pressing “P” in Object Mode, instead of Edit Mode, & accidentally triggering the Blender game engine