Articles
Textures and Materials
Texture Compression

Texture Compression

Before publishing an effect you should experiment with different compression settings to make your overall project size as small as possible. Smaller effects are quicker to load and this can improve the number of impressions your effect gets.

Any compression you apply in Spark AR Studio won't affect your original files.

It's also worth taking a look at our guide to optimization, for other techniques to help reduce the size of your effect.

Checking texture size

To help decide which textures would benefit from compression, you can see the file sizes for textures in both downloaded and unpacked bundles for each device type (iOS, Android, Older Android).

This is shown in the Inspector under Compression, when a texture is selected in the Assets panel.

You can also find which textures are taking up a lot of space in the Asset Summary.

Types of compression

There are three possible compression settings in Spark AR Studio for each target device (iOS, Android, Older Android):

  • Automatic — This setting finds the best compression format for your texture on the targeted device, ensuring your effect works on all devices.
  • Manual — Use this option to manually apply additional compression and control the settings.
  • None — This setting is not recommended but you could use it if you already compressed your textures before uploading them.

Spark AR uses automatic compression for all files when you add them to a project. This finds the best type of compression for each texture, for all devices — according to the image's contents.

If you want to compress textures in your project more, or less, you can either:

  • Adjust the compression setting for every texture in your project at the same time, in the project’s properties.
  • Adjust the compression settings for individual textures.

We recommend adjusting the compression settings for all textures at the same time first, then experimenting with individual textures if you need to.

Compressing all textures

Do this in the project properties:

  1. Select Project in the Menu bar.
  2. Select Edit Properties....
  3. Select Compression.

The Compression Method will be set to Automatic. This setting finds the best type of compression for each texture, for all devices - according to the image's content.

Adjust the Quality slider to apply more or less compression. The higher the quality, the less compression will be applied. It's best to experiment with this option before adjusting settings for individual textures.

You can change the Resolution for textures in your project here too. This will set the maximum texture size. A lower resolution can speed up compression and result in lower file sizes, but it will impact the quality of images.

It’s best to experiment with the Quality slider before adjusting the Resolution.

Manually compressing individual textures

To edit compression settings for each texture per device type:

  1. In the Assets panel select the texture and go to the Compression section of the Inspector.
  2. To the right of the device type (iOS, Android, Older Android), select Manual from the dropdown.

You’ll see options to edit compression Format, Max Resolution, Quality and Method. The available options for Format vary by device type.

Keep in mind that texture formats such as ETC2 and PVR result in better performance in lower end devices, despite the larger file size.

iOS

The following Format options are available for iOS devices:

  • PNG - When this option is selected and the Quality is set to high, lossless recompression is used to ensure small file sizes. When loaded into memory these textures will take 24 or 32 bits-per-pixel depending on the presence or absence of an alpha channel.
  • JPEG - Optimizes JPEG files using MozJPEG. When loaded into memory these textures will take 24 bits-per-pixel, no alpha channel.
  • PVRTC RGB (2 bit - 2 bits per pixel, no alpha channel.
  • PVRTC RGBA (2 bit - 2 bits per pixel, with alpha channel.
  • PVRTC RGB (4 bit) - 4 bits per pixel, no alpha channel.
  • PVRTC RGBA (4 bit) - 4 bits per pixel, with alpha channel.

PVR formats on iOS have the best rendering performance, although they tend to have a slightly larger file size than PNG.

Android

The following Format options are available for Android devices:

  • PNG - When this option is selected and the Quality is set to high, lossless recompression is used to ensure small file sizes. When loaded into memory these textures will take 24 or 32 bits-per-pixel depending on the presence or absence of an alpha channel.
  • JPEG - Optimizes JPEG files using MozJPEG. When loaded into memory these textures will take 24 bits-per-pixel, no alpha channel.
  • ETC2 RGB (4 bit) - 4 bits per pixel, no alpha channel.
  • ETC2 RGBA (8 bit) - 8 bits per pixel, alpha channel.
  • ETC2 RGB A1 (4 bit) - 4 bits per pixel, 1 bit alpha channel. A pixel will be either fully transparent, or fully opaque.

ETC formats on Android achieve the best rendering performance (although they tend to be a bit larger in size than PNG).

Older Android

You can choose from the following Format options:

  • PNG - Uses lossless compression via Zopfli to ensure small file sizes. When loaded into memory these textures will take 24 or 32 bits-per-pixel depending on the presence or absence of an alpha channel.
  • JPEG - Optimizes JPEG files using MozJPEG. When loaded into memory these textures will take 24 bits-per-pixel, no alpha channel.

Max Resolution, Quality and Method

Change the Max Resolution option to select texture’s maximum dimensions (width and height) of the texture. A smaller size will result in smaller textures, reducing the size of your effect.

You can't make the size of the texture bigger than the original, unless you resize it internally.

Editing the Quality setting applies more, or less, compression. This impacts how good the texture looks. The highest setting usually results in better quality effects - but devices will take longer to calculate the compression. For PNG and JPEG compression options, the quality setting impacts the file size.

You can also choose a compression Method. These settings let you choose to prioritize either compression level or speed. For example, Fastest is the quickest method but the compression is the poorest whereas Best takes compression to the highest level but it is very slow to complete.

Previewing compression

You can test the appearance and performance of your effects after applying compression using the Spark AR Player app.

Checking texture sizes

You can find which textures are taking up a lot of space in the Asset Summary. Then, you can decide where reducing texture size and applying compression will have the most impact.

To see the Asset Summary:

  1. Select View in the Menu bar.
  2. Click Show/Hide Asset Summary.

A list of all the assets included in your project, for each device type, will appear underneath the Viewport.

You'll see both downloaded and unpacked bundles. Unpacked bundles are the unpacked files, ready to be displayed. Downloaded bundles are the zipped up files that get downloaded to a device.

You can also see the size of each texture when it's selected in the Assets Panel. The file sizes for downloaded and unpacked bundles are listed under Compression in the Inspector:

Removing unused assets

You can also see which assets aren't being used in your effect in the Asset Summary. Removing these assets can improve performance.

If there are unused assets in your project, you’ll see them under Review Unused Assets button.

Remove any unused assets unless you know they're referenced in a script or the Patch Editor.

Was this article helpful?