Layar Developer Documentation

Back to layar.com

create texture animated 3D models

Using texture animation in your 3D model, you can add simple animations that bring the model alive. Note that due to the limitation of the mobile phone and the data connection used, there are some limitations that you need to consider.

Limitations

As each frame of an animated texture has to be loaded in the texture memory on the phone, you cannot put entire movies into a texture. You should compare texture animation to the simple animated gif files that were often used in the early days of the web.

NOTE: Any L3D files that are saved with a texture animation embedded will only show in Layar client version 3.5 and higher. If you want to present a 3D model to users of older versions, you should export another L3D file with only static images, and use the “version” parameter of the POI request to determine what 3D model file to serve to the user.

How to add animation to your objects

In order to use texture animations you need the latest version of the Layar3DModelConverter. Initial support for texture animation was added in version 2.0 of the converter and was limited to loading an animated gif image into a material.

We recommend that you use version 2.1 as this version contains many improvements in the creation of the animations by allowing you to add individual frames to the animation, without creating an animated gif image first.

The latest version of the converter can be started using this link:
 http://public.layar.com/downloads/Layar3DModelConverter.jnlp

Changing texture type 

On the materials tab of the model converter, you can see all the material contained in the 3D model, and the textures that are part of these materials. When you import an .obj/.mtl file, you will most likely only have static textures.

You can change the texture type for a material (see image above), by clicking on it and selecting one of three options:

When changing the texture type, the converter tries to keep the existing texture. So changing a static texture to animated will keep the static image as the first frame. If there was no texture before, you get an open file dialog where you can select the image(s) to use in the texture.


NOTE: When a material does not have a texture yet, adding a texture does not always lead to the correct results. For this to work, the .obj file should contain texture coordinates, otherwise the converter does not know how to place the texture on the model. For simplicity, it is recommended to use your 3D modeling software to add a static texture and change it to animated in the converter.

Adding and removing frames to the animated texture

When you have set a material to contain an animated texture, the texture preview will contain some more control options that you can use to change the animation (see image below).

The buttons have the following functionality:

Adjusting frame delay

As we are limited in the amount of frames you can use in an animated texture, the risk exists that the animation will look very static. By changing the frame delay between each frame, you can control how long each frame is visible. This allows you to bring more life to the animation.

Just click and edit the frame delay for each frame. The delay is given in milliseconds (1000 ms = 1 second).

Preview

The animation can be previewed on the preview tab of the model converter. Note that animation is not enabled by default in this tab for performance reasons. To enable it, use “View > Enable animation” (see image below).

Saving your model

When saving your model with texture animation(s) to L3D (using, “File > Save as...”), the files will be saved as a L3D file that is only compatible with Layar 3.5+. In the current version of the model converter, you will get a warning message about this.

Please make sure you also create a L3D file with only static textures if you want to serve 3D content to users of older versions of Layar.

Change texture in Command line

A new command is added to load animated textures.

-t : Load the given image file as texture on the material(s).

NOTE: this only really works for models with a single material/texture as the image will be set on all materials in the model.