Compression

Before publishing an effect on the Camera Effects Platform you should make it as small as possible. Smaller effects take less time to load on devices, so people are more likely to see them and share them.

The maximum export sizes is 2MB for effects for modern mobiles, and 12MB when opened on a device. For older devices, they'll need to be as small as possible to work well.

To make your effect smaller, you can:

  1. Remove unused assets.
  2. Compress individual assets - you can compress individual textures using tools built into AR studio.
  3. Change the default global compression settings - these are set to Smart Compression by default, which chooses the best type of compression for each texture and device type.

There are also some advanced compression controls you can try.

Compressing in AR studio will not affect your original files, so you can do it again and again.

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

Before you start your effect

Make sure the textures and objects you're planning to use meet our technical guidelines.

Removing unused assets

All assets listed in the Assets panel will be in the bundle of your finished effect - even if they're no longer included in the effect itself.

To see which assets are in use go to Project then Show Asset Summary. You'll see a screen that looks like this:

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

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.

In this effect we'd remove Old Texture. We'd select the asset and then click the bin icon in the bottom left of the asset panel:

Changing compression settings for individual textures

AR Studio has default global compression settings for textures. You can override these settings for individual textures that are taking up more space than they need to.

Find which textures are taking up a lot of space in the the Asset Summary. You'll see the sizes of assets across the 3 bundles AR Studio generates:

  1. iOS - PVR bundles.
  2. Android - ETC bundles (although some older Android devices will use PVR).
  3. 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.

Test different compression settings for the textures that will have the most impact on the size of your effect. In this example, we could experiment with compressing boater_01_var10.

A texture's compression settings are shown in the Inspector panel. You can change these settings, and check how your effect looks using the AR Studio Player app.

Compression settings

Type

Select from:

  1. Global Setting - applies the global compression settings.
  2. Override (Smart) - use the slider to choose the best type of compression for each texture, for all device types.
  3. Override (Manual) - to manually override textures for each device type.

Image Size

The texture's file size for both downloaded and unpacked bundles, for each of the 3 bundles AR Studio produces:

  1. Basic - this is for PNG and JPEG files and is used by all other devices that meet the OpenGL ES 2.0 standard - usually older Android devices.
  2. PVR - this includes PVRTC textures and is mainly used by iOS devices.
  3. ETC - this includes ETC2 textures and is used by Android phones that meet the OpenGL ES 3.0 standard.

Change the Image size to scale down the texture, which can help bring its size down.

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.

Previewing Compression in the Simulator

The Simulator will show how effects look on different devices after changing compression settings. Choose a device by selecting Device Type from the options in the center of the toolbar:

We've selected Samsung Galaxy S9, a newer Android. The Simulator will automatically update to show how the texture will look:

In our effect, the texture's image size is set to 1024. This means it looks very detailed:

In the Inspector panel we set the Max Size to 512 instead. We can see how it looks in in the Simulator with the new compression setting:

The effect still looks good, so we'd continue to preview and override the image size for each bundle.

Reducing the size of other assets

You could use another program to compress these types of files.

3D Objects

Reduce the polygon count of 3D objects in a 3rd party package.

Animation

Many effects still look good at lower frame rates. To reduce the number of frames:

  1. Go to Properties, then General.
  2. Adjust the slider to change the Desired Framerate.

Audio

Audio size isn't currently included in the asset summary, but make sure files are 32kbps mono AAC files.

Changing Global Compression settings

The global compression settings are set to Smart Compression by default. This aims to choose the best type of compression for each texture, for all device types.

If you haven't changed the settings of individual textures, any textures and assets in your effect will have these settings applied to them. To manually override global compression settings:

  1. In Project, select Edit Properties.
  2. Select the Compression tab.
  3. Change the Global Method to Manual Compression.

Manual compression options are the same as those available for individual textures. We recommend leaving these options as they are and reducing the size of individual assets instead, but changing them can be useful if an effect is intended for lower end devices or areas of low connectivity.

For example:

  1. Removing all Alpha channels can quickly bring an effect size down.
  2. Switching to RGB, JPEG and then Best method for Basic bundles.

If you change default compression settings, you'll keep any changes you've made to individual textures. Uncheck the box next next to Override in the Inspector panel to remove changes to individual textures.

Advanced Controls

Textures with Alpha channels

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.