Virtual Reality IK for Humanoid Avatars using Final IK in < 15 minutes

Note: to follow along with this week’s blog post on HTC Vive development, you may need to drop some dough on a Unity Asset called FinalIK for $90. Well worth the investment IMO.

If you’ve ever worked on a VR application, then you know one of the biggest challenges facing developers is how to map motion from motion controls, such as the Oculus Touch, or the HTC Vive controllers into the virtual space. Games like Batman Arkham VR and Hover Junkers do a pretty good job mapping your hands, head rotation, and position onto your virtual avatars, but until recently, if you wanted to do this as an indie developer, you would need to develop your own custom IK solution, which would be a complicated process that would probably take several weeks to get right.

As of a few weeks ago one of my favorite Partel Lang, updated his IK framework, Final IK to feature a super simple VR IK solver that allows developers to quickly use any rigged humanoid model and map their movements realistically to your own movements in real world space. In this blog post, I’ll describe how to easily set up your own humanoid model in VR. Disclaimer: these are based on some tutorials I found online, and have not been vetted by Partel. To the best of my knowledge, no documentation exists as of yet for the VRIK solver. If anyone has a better way or more efficient way to do this, I’d love to know!

Create a new project and import all the assets

If you are using Morph3d, make sure to go to Assets/MORPH3D/packages/ and click on Shaders first to import and then the character model second. order matters

Delete the camera in your default scene and add the [CameraRig] from SteamVR

You’ll want the position of the camera rig at origin (0,0,0)

Add your humanoid model into the scene view

If there are any animator controllers attached to your model’s animator make sure to remove them, as this can interfere with the IK.

Duplicate the right hand, left hand, and head

The bones may be named something different, but if it’s a standard humanoid model, you should be able to tell by the game object hierarchy, which bone to duplicate.

Drag the duplicate right hand, duplicate left hand, and duplicate head out to the scene view right below the scene name, set the position of all of these objects to (0,0,0)

Leave the rotation of the objects alone

Drag the game objects into the right places under [CameraRig]

right hand under Controller (right)

left hand under Controller (left)

head goes under Camera(head)

Attach the VRIK component to your model and assign the duplicate bones to the right position as displayed

Right Hand to Right Arm, Left Hand to Left Arm, Head to Head

Press Play, and it should work!

Here is an example video I uploaded of my experiments with VRIK. It’s a simple, silly, character creation screen.

FAQ

I can see through my character mesh (I can see their eyeballs, teeth, etc!) What do I do?

A couple of methods can be used here. The easiest of which is to just move the Camera (Eye) slightly out, in front of the model so you don’t see through them

Another method is to use a mirror in order to visualize the character in the mirror instead of directly by looking down. I found that this was less intrusive than having the model always there. Batman Arkham VR does this really well. In order to implement mirrors for the Vive, use the HTC stereo rendering package available for free on the asset store

Note that the mirror camera will sometimes will sometimes be occluded by the wall behind the mirror. You can set the mirror camera to ignore the wall mesh.

This is a technical discussion on how to use render textures and screen space shaders in order to reduce nausea in VR. Reader should have general understanding of programming concepts and Unity. I learned basic Read more…

While the types of games and experiences you can build in Unity are practically endless, chances are any game you can think of will probably involve moving something across the screen. Whether your game is Read more…