Using of 3D Engines in iOS Development

3D Engines for iOS Overview

Which 3D engine to select? This is the first question that appears in front of a developer when it comes to the development of a 3D graphics application or game for iOS/Android. In this overview we will try to give a brief description of several 3D engines that we’ve examined while solving such a question.

The task was to implement an application which loads a 3D model with skeletal animation and allows us to switch among several animations during different events such as: user interaction, geolocation updates, camera and accelerometer events, and so on. The main criterions for selection were: multi-platform support (i.e. an ability to redistribute the developed code and/ or scene among iOS and Android platforms), and full support of all OpenGL ES 2.0 features.

Unity 3

Unity is more like a 3D game development tool than a simple 3D engine. In fact you can’t even use it like most other 3D engines, including it in your Xcode project. Unity provides its own development environment which handles all stages of development, from creating 3D models and scenes, to building an application binary (Figure 1).

iOS development

Such an approach makes Unity a great tool for developing ordinary 3D games. But when you need some extended features in your 3D application, you may lack an ability to write your code in Objective C. For example, if you need to scan QR-codes into your application, zing is a great open-source library for that, but you can’t just include it in your Unity project. Unity allows us to build a plugin with Xcode and then to use it within our application. To note, you have to purchase Unity first in order to be able to use plugins within it. Thus, if you are only gauging to see if Unity fits your goals, there’s no way for you to try building your own plugin for testing.

Advantages:
  • Really cool game development environment which makes building 3D games an easy and visual experience
  • Full support of all the latest graphics technologies.
  • Great base for learning: documentation, tutori- als, examples, community, etc.
Disadvantage:
  • A developer is limited, able to only use the Unity game editor, and unable to use Xcode and write his own Objective C code.

SIO2

SIO2 is positioned as an in-expensive, but fully functional 3D engine. It encourages developers to use Blender as a 3D modelling tool and provides all necessary tools for exporting scenes from Blender to SIO2. However you can convert scenes to SIO2 from any 3D editor you like via the use of converting scripts.

On the engine’s web-resource, http://sio2interactive. com, you can find examples for almost any task that may be implemented with SIO2.

A weak point of SIO2 is that it’s still pretty raw as for a commercial product. Some features like loading a MD5 format and playing skeletal animations will sometimes not work, freezing a device or crashing it with BAD_ ACCESS without throwing any exceptions suitable for efficient debugging.

Additionally, Android support is quite new to SIO2, and as so it’s also fairly raw, sometimes refusing to run on various devices without explanation.

Advantages:
  • May be easily included within a Xcode project.
  • Full license includes source codes.
  • Good examples for almost any task on SIO2
  • web-resource.
Disadvantages:
  • Engine is still in a fairly raw state, especially considering Android support.
  • Poor support service; unable to help solve serious problems with engine usage effectively.

ShiVa3D

ShiVa3D is a 3D engine with a modelling environment, but unlike Unity it is able to export projects to Xcode and other development tools (depends on platform). It is very useful because with it you can first develop your game scene and logics in ShiVa3D editor, and then continue project development in Xcode using native iOS frameworks. The only negative aspect is that ShiVa3D editor tool only exists for the Windows OS.

ShiVa3D is also very useful in that you only have to pay for a license when you want to publish your application onto the AppStore. Before this step you are able to test all of the engine’s features for free.

A great feature of this engine is its Authoring Tool. This function solidifies ShiVa3D as the most fully cross-platform compatible engine in the world. The Authoring Tool compiles a project generated by ShiVa into an executable application for the following device platforms: Windows, Linux, Mac, IPhone, IPad, Android, Palm and Wii.

ShiVa uses the Lua script language for programing. Lua is very simple, taking only a few minutes to get a grasp of if you have C++ or Java experience. After building a project for some specified platform, all scripts are converted into C++, ensuring solid performance. You will find a lot of very useful information about this script at: http://www.stonetrip.com. The site includes a large developer forum, and is the perfect place to have specific questions and/ or concerns answered.

Additionally, ShiVa has a great API. It is well documented, giving examples for each function and the like. The API includes support of many types of hardware as well, including: accelerometers, microphones, joysticks, touch detection for touch displays, and etc (Figure 2).

iOS development

Advantages:
  • Useful game development environment with the possibility of exporting projects to Xcode and continue developing in Objective C.
  • Fully supports all the latest graphics technologies.
  • License required only for publishing, otherwise
  • usage is free.
Disadvantage:
  • Editor tool available only for Windows OS.
Moving forward, we would like to tell you about platforms where you can develop applications with the assistance of ShiVa 3D. The engine can successfully launch products onto Windows, Mac, Linux, iOS, Android, Palm OS, and Web OS, despite the fact that ShiVa itself exists solely in a Windows OS version.

The aforementioned Authoring Tool is a software product that accompanies ShiVa 3D for further application development and subsequent launch onto a specific platform. It exists in two variants; one for Windows and one for Mac. Creating applications on any platform with this engine is a three step process (Figure 3):

iOS development
  1. Download initial files exported from ShiVa
  2. Enter information regarding the app name, pro- vision file, and bundle depending on platform.
  3. Define folders where the application would be saved and specify certain graphics settings, for instance the use of OpenGL.


All these actions take roughly 3 minutes.

We’d like to say a few words about importing resources to ShiVa. First of all ShiVa can import 3D models in DAE format. In order to do that, you’ll need to download the Collada DAE plug-in -- it installs onto and works with the most popular 3D graphics packages, including 3ds Max and Maya. QrCode contains the link to a website where a more detailed description of the Collada DAE format is provided. To note, while working in this format we were confronted with certain difficulties while importing our model into ShiVa 3D. When saving 3D model textures, they remained in the same folders where they were initially located and subsequently opened by the program for modeling. Since a file in DAE format represents a XML file, paths to textures are in the same way. This means that if its transferred to another computer, the user will encounter path conflicts. As a result, only models without textures are able to be imported. After some time with the engine we’ve found 2 possible solutions to this problem. The first solution is to correct manually texture paths within the DAE file itself. The second solution is to convert textures to a TGA format and import them into ShiVa separately from the model. It’s important to also note that the size of textures should be aliquot to an n-power of two. This same requirement applies when creating iOS applications as well, and relates heavily to overall operational optimization and application speed. Regarding sounds: ShiVa accepts different sound resources in MP3 and WAV formats.

Discussing the graphic interface which ShiVa allows you to create: On the ShiVa website -- in the section for developers -- we will find graphic files where all native elements of Android and iOS apps are displayed. Elements such as: Scroll-bars, Buttons, and etc. This enables you to fully reconstruct the GUI of necessary platforms. We carried out experiments creating buttons using ShiVa, as well as the usual iPhone buttons that are located over a 3D scene. Our results showed 1-0 in ShiVa’s benefit. Our FPS counter showed a difference of 5 fps with ShiVa implementation. Support for different fonts also exists; in certain cases this feature greatly simplifies tasks at hand.

The ability to add animated textures is another a very useful feature. It allows us to create beautiful effects when developing menus and the like. Another serious advantage of ShiVa is the fact that it enables you to add different resources such as music and textures during run-time, into fully realized projects for certain platforms with the help of several script lines.

Stepping back, we ought to outline some more general opportunities ShiVa 3D provides. As noted, tits script language is Lua, which is a script with C-type and is not unusual, and makes your work much easier and more fluid overall. You won’t have to puzzle over learning its syntax as long as you are on of the 99% of developers experienced in Java or C+. Lua is a very simple, laconic, and intuitively understandable language. A brief guide is provided on ShiVa’s website in the API section.

While creating the project for any platform, all scripts you’ve developed will be converted into C++ code. This secures their immediate performance and legibility. Special wrappers with the wide set of functions that allow you to call your script event agents are provided as well. There are many wrappers, but in our experience the C function could be utilized to call any scripts we required.

Importantly, both OpenGL - 1.0 and OpenGL 2.0 - are used in ShiVa 3D. While ShiVa itself doesn’t provide an opportunity to program shaders or program on OpenGL, it controls their usage in in projects for maximum optimization and in no way influences final quality.

ShiVa’s API provides numerous advantages as well, encapsulated via the following features:
  1. Microphone support
  2. Multitouch Support
  3. Support for working with accelerometers
  4. Functions to work with XML.
This is by no means a small bonus. It frees you from needing to program on the iPhone as you are able to build your application right in ShiVa, solve issues, and resolve the problem of developing different interfaces via scripts that work with the above mentioned hardware, namely multi-touch screens and accelerometers.

You can review a step-by-step example of how a fully featured game was built using ShiVa 3D by visiting http://www.stonetrip.com/developer/242-the-hunt-the-making-of. The game itself is a casual 3D shooter created more-so as a tool to raise awareness for the ShiVa 3D engine than anything else. This game, titled The Hunt, is also helpful to prospective developers interested in using ShiVa 3D, as they can utilize completed portions of code used to make this game in their own projects.

Conclusion

Overall, ShiVa API includes several categories of lessons, such as lessons from developers and users. A number of instructional videos on YouTube are available as well, and despite the fact that they last only 60 seconds each, contain plenty of useful information. e, the basic version of ShiVa costs roughly 160 Euro, with a Pro version which costs 1500 Euro. That said, a free version which inprints a travelling line in the bottom part of your application explaining that the app was developed by means of ShiVa Free is available as an economic alternative as well. Buying a full license allows you to develop apps on the plenty of machines, ultimately producing the app in full.

ShiVa appeared relatively recently but has already gained a considerable client base, including multiple notable ones. Currently, there have been over nine thousand applications developed via the use of ShiVa.