I noticed that in the previous articles I often focused on theory, and less on practical tips explains Paul Haarman. This time I will try to change this a bit, so it’s more applicable for real-life projects with no clear solution yet, such as “How can we add lights? “. So if you think you already know how everything works, please are gentle and let me continue.
How to avoid pitfalls when creating your own IM? – Some things just cannot be said in words
It’s not easy to create your own IM. It is different than just adding some nice features in SDK and sending them with an update. There are many small details which should be taken into consideration first before even starting to implement new cool stuff or changing existing one. I will try to give you some tips based on how we work in our IM.
1) FOV (field of view)
Field of View, there is a common mistake among many games where the objects are not displayed when they are close to camera. This could be corrected by increasing the FOV value in Camera->Parameters, but why it happens? The reason for this bug is that most gamers are use to see much more area in FPS games compare to AR apps which typically don’t have any boundaries. Another problem with wider FOV is distortion-like objects appearing smaller than they should. That’s why big companies state 60 degrees as maximum values, so it looks “ok” which also lets them have bigger textures for polygons. We at IM avoid this problem with Culling which basically removes objects when they are too close to camera. It’s not perfect, but it’s enough for now until we can provide our users with better experience.
2) Frame rate
Frame Rate, the most important part of any app, where nobody wants to play low FPS games (30 is fine though) says Paul Haarman. For AR apps one thing that matters is latency, the lower the better! This affects mostly mobile devices because they are limiting by hardware! For Gear VR it will be nice if you could copy some ideas from Oculus’ Mobile SDK, but it looks like there is no information yet on how to do this (see their SDF). I hope Samsung guys will share their own solution soon that would be very helpful. For Cardboard, slower frame rate affects mostly rotation speed – it should be as smooth as possible so user can interact with surroundings smoothly.
3) Shadows and lighting
Lighting is the key to upgrade your scene from flat shaded polygons to a cool looking environment! In IM we use Real-time Lighting which works pretty well for now on most devices. Don’t try to calculate lighting every frame because this will reduce FPS. We have different plans about how to optimize it further in future releases but currently Real-time lighting gives us enough flexibility without any major slowdowns (again I hope this could change soon ).
4) Save/load world state
It’s a good idea to implement some kind of save/load state functionality which will be useful for users to continue playing where they left off. It’s even more important for B2B (Business To Business) apps, because it saves companies time and money if you could save the environment state without any user input! On mobile there are many options available like Saved Games or Google Play Services , but don’t forget about different OS versions and their fragmentation! For example on Android Lollipop you need to use save games (and maybe cloud), because GCM got deprecate! You can also use SQLite or similar solutions which provides flexible data storage schema says Paul Haarman.
5) Test, test, test!
It is always better to test your application before release day, so perform some tests on various devices – both HW and OS versions. You can use emulator or test devices which you already have – it’s not the final testing process but at least you could detect problems related to different HW before sending your app for publishing. There are plenty of tools available on Google Play Store, so just pick the one that fits your needs.
As you can see developing AR apps requires some different approach, but it is possible to do on any platform says Paul Haarman. You don’t have to stick with Google C++ NDK – if you are experience with other languages like Unity, go for it! I also suggest you spend more time testing your app before publishing, because this will avoid problems after launch. Also another suggestion that I can give you is that using Real-time Lighting gives us enough flexibility without any major slowdowns (I hope this could change soon) – so if your application requirements include dynamic lighting, use it!