Create texture-animated 3D models


 

Please NOTE that this documentation will not be updated anymore. Please see our new Developer Documentation Site for the latest updates! The content of this page can be found here.

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.
    •    Texture dimensions - 
We recommend that you use small images in your animations. While we do not have hard coded size restrictions, it is recommended to not go above 256x256.
    •    File size - Each frame of your animation will take up space and bandwidth for the user. Use good compression in your image files. In case of  PNG files, reducing the number of colors will reduce the file size. The total file size of the exported L3D model may not exceed 1Mb, but we recommend to stay well beneath this limit if you want to provide a good user experience.
    •    Number of frames - The number of frames supported by Layar in an animated texture depends on the dimensions and size. We have seen good results with more than 25 frames, but we recommend to limit yourself to around 10 frames. This is especially important if more 3D models (with animation) are visible at the same time.


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:


    •    “-” : No texture is assigned to the material. While rendering, only the diffuse/ambient/specular colors are used.
    •    “static” : Traditional fixed texture as was available since the introduction of Layar 3.0
    •    “animated”: Simple looped animation that allows you to add mulitple frames to the texture.


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 as below).

 


The buttons have the following functionality:


    •    “Add” - 
Add one or more frames to the animated texture. Supports selecting multiple files at once. When opening an animated gif, the embedded frame delay properties are also read and set in the animation.
    •    “Up” - Move the selected frame up in the frame list. This allows you to reshuffle the animation after adding the frames.
    •    “Down” - 
Move the selected frame down in the frame list.
    •    “Remove” - Remove the selected frame from the animation. Note, that the animation must contain at least one frame, so you cannot remove a frame if it is the only one.
    •    “Replace image” - Replace the image used in the frame. This button is also available for static images.


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 as 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.