Texture Compression in Spark AR Studio

Before publishing an effect you should experiment with different compression settings, so you can make your overall project size as small as possible. A smaller project size can improve the overall impressions that your effect gets.

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

In Spark AR Studio, you can either:

  1. Adjust the compression settings for individual textures.
  2. Apply the same compression to all textures in your project at the same time, by adjusting the global compression settings.

We recommend adjusting compression for individual textures, rather than changing the global settings. Any changes made to individual textures will override the global settings.

Whether you're adjusting settings for individual textures or globally, you can choose between using Smart Compression, or manual compression.

In this guide, you'll learn about:

To test the appearance and performance of your effects after applying compression, mirror your effect to a device using the Spark AR Player app.

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

Smart Compression and Manual Compression

Smart Compression automatically chooses the best type of compression for each texture, and for all devices - according to the image's contents. You can adjust Smart Compression to apply more, or less, compression. It's best to experiment with Smart Compression before adjusting settings manually.

Manual compression allows you to choose different compression settings for the different bundles exported by Spark AR Studio.

Finding Compression Settings

To see and adjust the compression settings for individual textures:

  1. Select the texture in the Assets panel.
  2. Go to Texture Sizes and Compression in the Inspector panel:


To see and adjust global compression settings:

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

You'll see these options:

Previewing Compression

However you adjust the compression settings, you'll be able to see the results in the Simulator.

If you're manually changing the compression options, make sure the Device Type reflects the compression setting you're testing. For example, if you've checked the box next to Override iOS, make sure the Device Type is set to an iOS device.

To do this, click the dropdown under Device Type in the Toolbar:

Checking Texture Size in the Asset Summary

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

To see the Asset Summary:

  1. Select Project in the Menu bar.
  2. Click Show Asset Summary.

You'll see a screen that looks like this:



You'll see the sizes of assets across the 3 bundles Spark AR Studio generates:

  • iOS - PVR bundles.
  • Android - ETC bundles (although some older Android devices will use PVR).
  • Older Android - Basic bundles.

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

You can also see the size of each texture when it's select in the Assets panel. The file sizes for downloaded and unpacked bundles are listed under Image Size.

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.

Assets that are being used in the effect have a tick next to them under the In Use column. If assets are referenced in a script, they won't be shown as In use.

Remove any assets that don't have a tick next to them - unless you know they're referenced in a script. In the example above, we'd remove Old_Texture.

To remove an asset:

  1. Select the asset in the Asset Summary.
  2. Click the bin icon in the bottom left of the Asset Summary.

If there are any gaps in the table, click Compress All. This will compress your effects and tell you the size of all your assets.

Changing Texture Size

It's worth experimenting with different texture sizes/resolution settings:

To do this, either:

  • Change the Image Size in the Inspector panel - for individual textures.
  • Change the Resolution in the Project Properties - to apply the change globally.

Using Smart Compression

Applying Smart Compression to individual textures

To apply Smart Compression to a texture:

  1. Select the texture in the Assets panel.
  2. In the Inspector panel, change Type to Override (Smart).
  3. Adjust the slider.

You'll be able to see how your effect looks with compression applied in the Simulator. You'll see the impact on the size of the texture in the Inspector panel, under Texture Sizes:



Applying global Smart Compression

We recommend leaving the global options as they are, and reducing the size of individual assets instead. However, changing them can be useful if an effect is intended for lower end devices or areas of low connectivity.

To change the global smart compression settings, go to Project Properties in the Menu.

Adjust:

  1. The Resolution options - 1024x1024 is the maximum texture size. Spark AR Studio will automatically downsize anything over this.
  2. The Quality slider - A higher number will mean an improved visual quality, but a larger file size.

Using Manual Compression

To use manual compression, either:

  • Change the Type to Override (Manual) in the Inspector panel - if you're compressing individual textures. You can then experiment with different compression options, for each bundle.
  • Change the Global Method to Manual in the Project Properties - if you're changing global settings.

The compression options are the same, whether you're changing the global settings or settings for individual textures.

Override iOS

Max Size

Limit the size of the texture. You can't make the size of the texture bigger than the original, unless you're stretching an image to make it square.

Compression

The following compression options are available for iOS devices:

  1. PNG/JPEG (Automatic) - The default option which optimizes imported PNG or JPEG files to the smallest possible size, using lossless recompression.
  2. RGBA (Passthrough) - Uses the original file, as it is.
  3. RGBA (PNG) - Uses lossless recompression 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.
  4. RGB (JPEG): Optimizes JPEG files using MozJPEG. When loaded into memory these textures will take 24 bits-per-pixel, no alpha channel.
  5. PVRTC_V1 (Automatic) - Automatically switch between PVRTC_V1_4_RGB and PVRTC_V1_4_RGBA depending on the use of alpha channels in the texture.
  6. PVRTC_V1_2_RGB - 2 bits per pixel, no alpha channel.
  7. PVRTC_V1_2_RGBA - 2 bits per pixel, with alpha channel.
  8. PVRTC_V1_4_RGB - 4 bits per pixel, no alpha channel.
  9. PVRTC_V1_4_RGBA - 4 bits per pixel, with alpha channel.

Depending on the type of texture you're compressing, some methods will look better than others. Selecting PVRTC_V1 (Automatic) will choose the best method for your texture depending on whether you have an Alpha channel or not.

Accuracy

The highest accuracy setting usually results in better quality effects, but it will take longer to calculate the compression. We recommend using Highest, because it doesn't effect the file size.

Dithering

Check this box to help remove banding in some images, especially those with gradients.

Override Android

Max Size

Change the size of the texture.

Compression

The following compression options are available for Android devices:

  1. PNG/JPEG (Automatic) - The default option which optimizes imported PNG or JPEG files to the smallest possible size, using lossless recompression.
  2. RGBA (Passthrough) - Uses the original file, as it is.
  3. RGBA (PNG) - Uses lossless recompression 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.
  4. RGB (JPEG) - Optimizes JPEG files using MozJPEG. When loaded into memory these textures will take 24 bits-per-pixel, no alpha channel.
  5. ETC2 (Automatic) - Automatically switch between ETC2_RGB, ETC2_RGBA and ETC2_RGB (Punch-through alpha) depending on the usage of alpha in the source texture
  6. ETC2_RGB - 4 bits per pixel, no alpha channel.
  7. ETC2_ RGBA - 8 bits per pixel, alpha channel.
  8. ETC2_RGB (Punch-through alpha) - 4 bits per pixel, including a 1-bit alpha mask (therefore regions are either fully opaque or fully transparent).

Depending on the type of texture you're compressing, some methods will look better than others. Selecting ETC2 (Automatic) will choose the best method for your texture, depending on whether you have an Alpha channel or not.

Override Older Android

Compression

The following options are available for this compression scheme:

  1. PNG/JPEG (Automatic) - The default option which optimizes imported PNG or JPEG files to the smallest possible size, using lossless recompression.
  2. RGBA (Passthrough) - Uses lossless recompression to optimize imported PNG or JPEG files to the smallest possible size.
  3. RGBA (PNG) - Uses lossless recompression 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.
  4. RGB (JPEG) - Optimizes JPEG files using MozJPEG. When loaded into memory these textures will take 24 bits-per-pixel, no alpha channel.

Accuracy

The highest accuracy setting usually results in better quality effects, but it will take longer to calculate the compression. For basic bundles, accuracy settings effect file size.

Advance Controls if You're Using Manual Compression

Textures with alpha channels

Removing all alpha channels can quickly bring an effect size down.

For ETC2 formats, select Punch Through Alpha. This is half the size of an ETC2_RGBA - so you'll need to test it to make sure your effect looks okay.

If a texture with an alpha channel isn't appearing as expected, check you're using RGBA, rather than RGB.

For PVR formats, you can try overriding large textures to 2BPP rather than 4BPP formats. Use Highest Accuracy, as 2BPP textures can look poor.

Basic bundles

For Basic bundles, set the format to PNG and Quality to Medium or Lowest. This will reduce the PNG to a 256-color variant which should save space, but loose some quality. Set Method to Best to get the tightest compression.

Block compressed textures

Blocked compressed textures improve performance.

This is because block compressed textures are loaded as raw data and decompressed by the GPU during rendering. GPU has dedicated hardware to decompress these textures. Given these compressed textures reduce bandwidth, it's generally faster for the GPU to decompress block compressed textures than to load raw uncompressed textures.