Construction of complex 3D scenes couldn't be simpler! You don't need to be an expert in computer graphics to create exactly what you want in just a few lines of code. Construct a 3D object, give it a material, position it in the scene or relative to another object... iSGL3D is designed so that you type what you think.
It's just as easy to perform transformations on the objects in the scene. Intuitive methods allow you position, rotate and scale all objects. You can also modify the transparency of the object, indicate whether lighting has an effect on it, specify whether you want it to cast shadows, etc all in single lines of code.
iSGL3D includes a rapid maths library for vector and matrix operations that are hardware accelerated whenever possible. These allow you to modify the transformations of the objects directly or relative to each other. The underlying hardware accelerated graphics ensures that the scene is rendered as quickly as possible.
Adding a light to a scene couldn't be simpler with iSGL3D: just create one and add it! iSGL3D provides three types of lighting:
Not all objects in the scene have to be lit by the light: you can turn off lighting effects for any of them, and this can even be beneficial to overall performance.
Lights are composed of three different components:
These light properties along with the material properties (discussed later) allow you to precisely modify how lighting interacts with an object and how this is perceived by the user.
In iSGL3D you can include up to four different light sources to any scene. Performance is always best if a minimum of lights are used however!
Cameras in iSGL3D behave exactly like cameras in the real world. When using a camera you can modify its position, direction, zoom, focus and field of view. All of this can be done dynamically allowing you to, for example, follow a character as a third-person or simply pan across a scene. By default a camera provides a perspective view of the scene however you can also use an orthogonal projection.
iSGL3D provides types of cameras that allow you to follow an object automatically without you having to constantly update its position and direction.
You are not limited to a single camera either: if you want to give the users freedom to chose between different camera positions then you simply create and add a number of them to the scene and indicate which one is currently active.
A view in iSGL3D consists of a scene, a camera and a window through which the scene is observed. The window, or viewport, uses the full screen by default, but you are free to choose any area on the screen to render the scene.
In iSGL3D you can have any number of views allowing you to render different scenes simultanously. These views can either be layered or positioned (by defining different viewports) so that a user can have two or more different views of a scene (or different scenes) at the same time.
Layering views is useful when it comes to rendering a 2D user interface (or HUD) above a 3D scene. Using different viewports is useful when, for example in a racing game, rendering the scene from a different camera angle above the first-person 3D view in a smaller rectangle. Two-player games on the iPad are also possible with players facing each other and playing simultaneously.
Views can be opaque or transparent. Opaque views will hide all renderings behind them and can have independent background colors while transparent ones allow views below them to still be seen (as for a 2D user interface). They can also have their own rotations, for example, in the case of two-player games.
Meshes and particles (or sprites as they are otherwise known) are the principal means of rendering objects on the scene.
Meshes are 3D objects composed of triangles. Each vertex of a triangle is specified by a position vector, a normal vector and a UV coordinate (to map textures onto the mesh). iSGL3D provides a number of built-in primitive meshes (such as spheres and planes) that are incredibly easy to add to the scene. You can, however, import your own meshes created using third-party 3D design applications. To render a mesh simply associate it with a material and add it to the scene.
Billboards are also supported with iSGL3D. These are planar meshes that are always rendered face on to the observer no matter where the camera is pointed. In fact, in iSGL3D billboards don't need to be planar - you can add any kind of mesh to a billboard node and the mesh will always be rendered looking towards to the camera.
Particles are 2D objects that are rendered with increased efficiency. Particles are always face-on to the viewer and cannot be rotated, however, you can add many hundreds of them to the scene without significant performance issues. This makes them ideal for animation effects such as explosions and fountains. iSGL3D provides several built-in particle generators that allow you to achieve this very rapidly.
Primitives, as mentioned above, are built-in meshes that help with the rapid construction of scenes. You can create them with different parameters to suit your needs such as the number of triangles to use or their size.
The primitives included in iSGL3D are: Cube, Sphere, Plane, Cone, Cylinder, Arrow, Ellipsoid, Torus, Ovoid (en egg shape), Goursat Surface (a rounded cube) and Terrain.
The Terrain primitive allows you to create a 3D terrain directly from a color channel of an image: the intensity of the color modifies the elevation on the surface.
An essential ingredient to any 3D application are the materials. A material allows you to modify the appearance of both meshes and primitives, add realism to objects and specify how lighting behaves with an object. There are three principal types of materials:
iSGL3D takes advantage of the hardware accelerated graphics of the iPhone, iPod touch and iPad using OpenGL ensuring that the fastest possible rendering is provided for your application.
For the developer, the complexities of OpenGL are completely hidden by iSGL3D: the low-level operations on the graphics card are handled and optimized by iSGL3D so that you can concentrate on building the scene.
iSGL3D is built on OpenGL ES. Both OpenGL ES 1.1 and OpenGL ES 2.0 are supported. When you create your 3D application with iSGL3D, you can, if you wish, chose which of these you want to target.
OpenGL ES 2.0 has the potential of providing a richer graphical experience for users.
Only since the iPhone 3GS and 3rd generation iPod touch do these platforms accept OpenGL ES 2.0. You can still base your application on this version of OpenGL even for older iPhones and iPods: iSGL3D automatically detects whether it is available and switches to OpenGL ES 1.1 if not. iSGL3D automatically switches to the latest version of OpenGL available to the platform it is running on.
iSGL3D has been specifically designed to produce virtually identical results for core functionality (such as lighting, simple shadows, textures and particles) on both versions of OpenGL. The choice of version can be transparent to the developer: the construction of the scene and manipulation of the objects remains identical.
It is likely that in future versions of iSGL3D that more advanced features will be produced only for OpenGL ES 2.0.
POD courtesy of Imagination Technologies Limited
The iSGL3D framework is designed such that 3D models designed on third party tools can be easily imported.
iSGL3D takes advantage of the Imagination Technologies POD format which is optimized for the iPhone family. The importer class source is available as a separate download allowing you to modify and fine tune it to your desires.
Don't have a 3D model in a POWERVR POD format? Don't worry, Imagination Technologies provides plugins for Autodesk 3ds Max and Autodesk Maya to export your models in this format. They also provide a standalone tool to convert from Khronos COLLADA format to POD format. You can find these tools on the Imagination Technologies website on their POWERVR Insider Utilities page.
With the iSGL3D importer, you can not only import individual models but whole scenes so that the camera, lighting and all the meshes are rendered exactly as you see them in the design tool.
It is highly probable that in later versions, support for these different model formats will be provided natively by iSGL3D.
iSGL3D doesn't provide an in-built library for physics methods: other groups have already provided excellent libraries to achieve this. iSGL3D does allow you to easily incorporate these libraries into your design and render the equivalent physical bodies on the screen.
To illustrate how easy it is to merge the Bullet Physics Library into an iSGL3D application, source code for bridging to Bullet is provided in the Downloads area.
Shadows naturally provide realism to any 3D scene. However, adding this realism naturally comes at a price in terms of rendering performance. iSGL3D allows you to increase the performance by specifying which objects cast shadows and also which light sources generate shadows. You can also specify which objects allow shadows to be cast on them as well as modify the intensity of the cast shadows.
iSGL3D currently provides two methods of rendering shadows:
Tweening (or inbetweening) is a very simple means of animating an object. Imagine you want to move an object from position x to position y. With a Tween you specify the start and end positions (or any properties of your object), the duration of the movement and the interpolation function to be used for the movement. The Tween then automatically modifies the object property values and the object is seen to move on the screen.
With a Tween you can modify any public property of your object to provide a great number of different animations: movements, rotations, scaling, transparencies, etc. You can also specify any number of properties to be animated at the same time.
When the animation has finished, you can specify a call-back function to be executed so that, for example, the animation of a ball thrown upwards will start coming down again when it reaches its highest point.
POD courtesy of Imagination Technologies Limited
More complex animation can be provided by directly animating the meshes. This is achieved by providing a skeleton to a mesh, attaching each vertex to one or more skeleton joints and indicating how the vertices are influenced (via a weighting) by each bone, known as skinning: the mesh is seen as a skin that moves accordingly to the skeleton positions.
The skeleton positions are prescribed for a number of different frames: an animation is made by cycling through the different frames and as the bones move the skin (or mesh) follows.
With iSGL3D you can create skeletons and add a number of frames with different bone positions. You can also add meshes to the skeleton to produce skinning.
Assets that you've created in third-party 3D design applications that are already animated with skin an bones can be immediately imported into iSGL3D (the POD importer discussed provides this functionality). Once imported, the animation controller of iSGL3D allows you start, stop and modify the speed of the animation.
Another form of animation comes from vertex animation, also known as morphing. iSGL3D allows you to provide a number of meshes coming from the same original model and perform vertex-by-vertex interpolation between the meshes.
POD courtesy of Imagination Technologies Limited
Keyframe data allows you to specify which meshes should be rendered at a particular time - at a specific instant in time one mesh is rendered and then, for a specified duration, interpolation is performed to the next mesh along the time-line. This allows you to finely control the animation you want to perform and use any number of meshes in your animation sequence.
iSGL3D allows you to automate the animation so that at each frame the interpolation follows the time-line that you've specified, or you can specify manually which meshses should be interpolated during the run-time of your application.
iSGL3D provides a simple interface to the accelerometer available in the iPhone, iPod touch and iPad. You can easily determine the tilt and rotation of the device, as well as the movements of the device, and integrate these into the application you are developing.
Being able to interact with the 3D objects you render can really enhance the user experience of a 3D application.
With iSGL3D you can specify which objects the user can interact with (responding to touch, release and movement events). iSGL3D also provides the freedom to interact with a number of objects at the same time (multitouch).
At the same time, iSGL3D leaves you free to provide your own touch screen support for more general interactions, for example, moving a finger over the screen to control the camera direction.
For situations where a target object should always be visible to the user, occlusion transparency allows you to automatically make occluding objects become transparent. Imagine walking through a dense forest and you need to be able to search for an enemy; with occlusion transparency the trees immediately in front of you become see-through and then become opaque again when you look in a different direction.
iSGL3D provides this functionality with just a single line of code. You can then configure the angle from the line of sight at which objects become transparent, as well as the amount of transparency that occurs.
As well as providing a simple means of constructing a 3D scene, iSGL3D also allows you to contruct a 2D user interface with widgets such as buttons, images, progress bars and labels as well as basic layout support for each of these.
The user interface is rendered above the 3D scene providing a simple means of allowing a user to interact with your application.
Currently in its infancy, the user interface support of iSGL3D will be enhanced in the future to provide additional widgets and a more complete layout framework relevant to 2D interface design.
Copyright © 2011 iSGL3D. All rights reserved.