Archiact is thrilled to introduce our newest blog series, VR Academy!
VR Academy is your front row seat to the latest and greatest tips on developing in virtual reality. Archiact has over two years of technical VR development experience, and we want to share our knowledge with you. Our team is stacked with experts on 3D rendering, optimization, and shader programming. With our skillset and extensive VR knowledge, Archiact is happy to bring you VR Academy.
Archiact's very first VR 101 topic is.... Colliders!
Let's get started.
When your project is running on a phone and has to look good in a stereoscopic viewer, optimizing your assets is key to ensure your frame rate stays as clean as possible.
One optimization factor that?s important is collision detection. The easiest but worst thing you can do for a complex organic object is generate a Mesh Collider in Unity. The standard mesh collider is perfectly form-fitting, but it´s the heaviest option in terms of processing power. Using basic primitives (cubes, etc) for colliders is ideal, but sometimes when you´re working with more organic assets, such as the entire asset repository for Lamper, primitive shapes aren´t form-fitting enough and other optimization tricks need to be utilized. Lamper´s environment consists of spiralling organically-shaped vines, caves, plants - and they´re absolutely everywhere!
We´ve developed our own automated system to help us create the colliders for our environments.
Firstly, we don´t apply colliders directly onto our environmental assets. We create entirely separate meshes to serve as the colliders in each piece of the Lamper environment:
Photo above: A screenshot of the colliders at work in the Unity engine. The green lines represent the collider mesh over the environment.
The collider mesh is heavily optimized around the walls and floor, but not as much on the vines, which need more accurate form-fitting colliders to ensure Lamper can hit them and glide smoothly over their geometry. The walls and floor, although they are very bumpy, have straight / smooth colliders. Not only does this help performance, but it helps Lamper reflect itself back onto a forward path (rather than getting stuck in crevices.)
We´ve also implemented scripts that optimize our collider pipeline process. Our scripts grab the environment colliders from the meshes and automatically sets them to `convex´ (vs `concave´) depending on its naming convention (ex: UCV_meshasset). We try to avoid using concave meshes as much as possible as they´re generally heavier than convex ones.
Lastly, our scripts grab each collider on a mesh and put it into a separate prefab object. At runtime, it instantiates only the colliders Lamper can hit rather than all colliders we´ll need later in the upcoming areas of the environment, which helps further optimize Lamper for mobile.
If you want to see this collision system in action, check out our latest build in Lamper VR: Firefly Rescue on the Samsung Gear VR store.
Receive blog posts by email
Sign up below and we'll email you every time we make a new blog post.