Texture compression unity android что выбрать

Unity Texture Compression (Android and iOS)

Unity iOS & Android Texture Compression Guide Overview

Unity texture compression is a very important step to developing mobile games for android or iOS. Keeping the filesize of your game build low means players are able to download the game faster and some may even abandon the download if it’s taking too long!

This guide explains how to do unity android texture compression as well as unity iOS texture compression and also explains other texture optimization techniques to improve unity mobile rendering performance!

Why Should I Compress Unity Textures?

Texture compression unity android что выбрать. 2017 09 23 19 26 57 e1506191485789. Texture compression unity android что выбрать фото. Texture compression unity android что выбрать-2017 09 23 19 26 57 e1506191485789. картинка Texture compression unity android что выбрать. картинка 2017 09 23 19 26 57 e1506191485789

Textures are generally the main cause of high build filesizes, especially when you have a lot of textures at higher resolutions! Texture compression in Unity allows you to reduce the filesizes of your textures and in most cases makes no visual difference!

You can find out exactly what’s causing your build filesizes to be so high with the Editor Log. After making a build open the editor log from the dropdown menu top right of the console (Open the console from Window > Console) (Alternatively on windows it can be found in %localappdata%/Unity/Editor/)

In the editor log search for ‘Used Assets and files from the Resources folder, sorted by uncompressed size:‘. Below this line is a list of all assets included into the build ordered by their filesize.

From here you can go through the assets and determine what you can do to compress or remove some of these items. This guide explains how you can compress the images (Textures) from this list.

Viewing the Target Texture Import Settings

Unity texture import settings can be adjusted by selecting the texture in the project window to show the texture import settings in the inspector window.

From the texture import settings you can set texture compression, control mip-mapping and adjust few other useful texture settings.

Texture compression unity android что выбрать. Unity 2017 09 23 18 02 31 e1506187031275. Texture compression unity android что выбрать фото. Texture compression unity android что выбрать-Unity 2017 09 23 18 02 31 e1506187031275. картинка Texture compression unity android что выбрать. картинка Unity 2017 09 23 18 02 31 e1506187031275

(If you don’t have the project window or inspector window visible you can add them from Window > Project and Window > Inspector and if selecting objects from the project window isn’t showing the import settings try pressing the lock icon top right of the inspector)

With your texture selected you’ll want to select your target platform and tick the override checkbox (In older versions of Unity you could just set the compression format from the default tab to affect all platforms, however this was changed in later versions of Unity 5. – Note if you’re using an older version of Unity you need to set the Texture Type to Advanced before you are given the option to select specific compression formats rather than just automatic)

Unity Texture Compression Options

Max Size
This will set the maximum resolution allowed for this texture, e.g if your texture is 3000×3000 setting this to 2048 will set the texture resolution to 2048×2048, if the original texture size is smaller than the selection e.g 2000×2000 then setting this to 2048 will not affect the texture resolution, keeping it at native file resolution.

Compression
This is found in the default tab and seems to be the replacement for auto compression from the older versions of Unity. I recommend keeping track of your textures and manually setting the unity texture compression where possible.

Auto compression may be good enough if you’re feeling lazy, however I personally have never seen a difference between low, medium and high quality levels visually or filesize-wise so I’m not entirely sure what difference they make.

Format
The texture compression format which the texture will be compressed with. You should try stick to a specific format across your entire project to ensure you don’t run into compatibility issues.

On Android when a compression format isn’t natively supported it’ll switch to software decompression which is MUCH slower. Usually for Android you’ll want to stick with ‘ETC2’ texture compression formats, using ‘RGB Compressed ETC2 4 bits’ for opaque textures and ‘RGB + 1-bit Alpha Compressed ETC2 4 bits’ for transparent textures.

However if the textures appear glitchy or transparency stops working then use ‘RGBA Compressed ETC2 8 bits’ which results in a slightly higher texture filesize but should fix any issues with the texture.

Compressor Quality
Visible after selecting some compression formats. This sets the level of compression between fast, normal and best – I have never personally seen any texture changes in filesize or visual quality from setting this on any compression methods other than crunched (which will degrade the texture quality)

Note that setting best on some textures (usually textures with transparency) causes Unity to hang for a long time, so you probably should just leave this set to ‘Normal’ unless you are using a crunched compression format or have some other reason to change it.

Mip Maps

What Are Mip Maps?

Mip maps are smaller versions of the original texture which are used instead of the actual texture when the rendered object is far away from the rendering camera.

They improve GPU rendering performance as the GPU renders much smaller textures and can also reduce texture aliasing without anti-aliasing being needed.

How To Use MipMaps

Under the Advanced section of the texture import settings is a checkbox to ‘Generate Mip Maps’ this will generate the smaller versions of your texture to be generated and built into your game alongside the full sized texture (You can preview mip-maps with the mip-map slider).

Rendering the smaller mip-map textures which are used at a distance is much faster for GPU rendering and reduces harsh aliasing at a distance, especially when used with anisotropic filtering.

Texture compression unity android что выбрать. mipmaplevels.png.pagespeed.ce.mRkwHBRLYv. Texture compression unity android что выбрать фото. Texture compression unity android что выбрать-mipmaplevels.png.pagespeed.ce.mRkwHBRLYv. картинка Texture compression unity android что выбрать. картинка mipmaplevels.png.pagespeed.ce.mRkwHBRLYv

This example uses strong colour contrasts to make the aliasing effects more obvious but you can see how mipmaps and different filtering levels affect rendering.

Note that generating mipmaps increases the total filesize of the texture by about 25% so if you’re trying to keep filesize low and either the texture looks fine at a distance, will never be viewed at a distance or GPU rendering costs aren’t an issue then you can keep mipmaps disabled to reduce game filesize.

(Make sure Anisotropic Textures are enabled in your Quality Settings if you want to filter your textures!)

POT Textures

What Are POT Textures and NPOT Textures?

POT & NPOT stand for ‘Power of Two’ and ‘Non Power of Two’.

A POT texture is where a texture has a resolution of 2^n x 2^n (which means the height and width is either 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096.. etc).

NPOT is the reverse of this, a texture which does not have a height/width which is a power of 2.

Only POT textures can be compressed if mipmaps are enabled

If you’re trying to compress a NPOT texture with mipmaps enabled Unity might warn you that ‘Only POT textures can be compressed if mipmaps are enabled’.

You can either directly edit your texture or use Unity’s built in texture import settings to force squash or stretch the texture to be power of two.

Expanding Advanced there’s an option for ‘Non Power of 2’ this will allow you to make Unity slightly squash or stretch a texture to the nearest power of 2.

The reasons why POT textures are important is because unless the texture is POT you won’t be able to use some compression formats and mipmaps cannot be used on the texture.

(On old hardware you may find that NPOT textures use more memory than expected too as they’re being stored into memory as next highest POT sizes!)

Texture compression unity android что выбрать. UnityPOT. Texture compression unity android что выбрать фото. Texture compression unity android что выбрать-UnityPOT. картинка Texture compression unity android что выбрать. картинка UnityPOT

Additional Tips

Remember that not all textures will be equally visible in games, some textures may never even be visible up close! In cases where textures won’t come close to the camera you could probably bring your texture resolution down to a lower level and enabling mipmapping to improve render costs.

If you’re developing a mobile game you try also try not to go over the top with level of detail! On small mobile screens detail won’t be as visible as it is in your editor screen so consider bringing resolutions lower and previewing them on a phone or tablet.

I also always suggest using texture compression on ALL your textures! There should be a compression method which works for you in all cases without any or very little visual change.

Источник

Recommended, default, and supported texture compression formats, by platform

This page contains the following information:

This page does not contain information about console platforms. For information about console platforms, see the platform-specific documentation.

For an overview of texture compression formats, see Texture compression formats. For information about texture import settings and how to set up platform-specific overrides, see Texture import settings.

Terminology

This page uses the following terminology:

Recommended texture compression formats, by platform

Desktop

See the Supported texture compression formats reference table for detailed information about all supported formats.

iOS and tvOS

See the Supported texture compression formats reference table for detailed information about all supported formats.

Android

Texture compression support on Android is complicated, and you might need to build several application versions with different sub-targets.

Unless your app targets specific hardware that supports a limited range of texture compression formats, you can choose between several compressed and uncompressed formats, which offer different trade-offs.

For devices that don’t support ASTC HDR, all devices running Vulkan, Metal, or OpenGL ES 3.0 support RGB9e5, which is suitable for textures without an alpha channel. If an alpha channel or even wider support is needed, use RGBA Half. This takes twice as much memory as RGB9e5.

See the Supported texture compression formats reference table for detailed information about all supported formats.

Default texture compression formats, by platform

The following table shows the default formats used for each platform.

PlatformColor modelNoneNormal quality (default)High qualityLow quality (higher performance)
Windows, Linux, macOSRGBRGB 24 bitRGB Compressed DXT1RGB(A) Compressed BC7RGB Compressed DXT1
RGBARGBA 32 bitRGBA Compressed DXT5RGB(A) Compressed BC7RGBA Compressed DXT5
HDRRGBA HalfRGB Compressed BC6HRGB Compressed BC6HRGB Compressed BC6H
WebGL A JavaScript API that renders 2D and 3D graphics in a web browser. The Unity WebGL build option allows Unity to publish content as JavaScript programs which use HTML5 technologies and the WebGL rendering API to run Unity content in a web browser. More info
See in Glossary
RGBRGB 24 bitRGB Compressed DXT1RGB Compressed DXT1RGB Compressed DXT1
RGBARGBA 32 bitRGBA Compressed DXT5RGBA Compressed DXT5RGBA Compressed DXT5
Android (only when Don’t override is enabled in the build settings)RGBRGB 24 bitRGB Compressed ETCRGB Compressed ETCRGB Compressed ETC
RGBARGBA 32 bitRGBA Compressed ETC2RGBA Compressed ETC2RGBA Compressed ETC2
iOSRGBRGB 24 bitRGB Compressed PVRTC 4 bitsRGB Compressed PVRTC 4 bitsRGB Compressed PVRTC 2 bits
RGBARGBA 32 bitRGBA Compressed PVRTC 4 bitsRGBA Compressed PVRTC 4 bitsRGBA Compressed PVRTC 2 bits
tvOSRGBRGB 24 bitRGB Compressed ASTC 6×6 blockRGB Compressed ASTC 4×4 blockRGB Compressed ASTC 8×8 block
RGBARGBA 32 bitRGBA Compressed ASTC 6×6 blockRGBA Compressed ASTC 4×4 blockRGBA Compressed ASTC 8×8 block
DefaultRGBARGBA 32 bitRGBA 16 bitRGBA 16 bitRGBA 16 bit

Supported texture compression formats, by platform

The table below shows each compression format available in Unity, and the platforms that support it.

Texture compression formatDescriptionChannelsQualityBits per pixelSize of 1024×1024 texture, in MBWindowsMacLinuxAndroidiOS & tvOSWebGL
RGB(A) Compressed BC7Compressed RGB or RGBARGB or RGBAHigh81yes (1)yes (1)yesnonono
RGBA Compressed DXT5Compressed RGBA (also known as BC3)RGBAMedium81yesyesyesno (3)nopartial (2)
RGBA Crunched DXT5Compressed RGBA, with additional on-disk Crunch compressionRGBALow to mediumVariableVariableyesyesyesno (3)nopartial (2)
RGBA 64 bitUncompressed RGBA, very high precisionRGBAVery high648yesyesyespartial (6)yesno
RGBA 32 bitUncompressed RGBARGBAHigh324yesyesyesyesyesyes
RGBA 16 bitQuantized RGBARGBAMedium162yesyesyesyesyesyes
RGB Compressed DXT1Compressed RGB (also known as BC1)RGBMedium40.5yesyesyesno (3)nopartial (2)
RGB Crunched DXT1Compressed RGB, with additional on-disk Crunch compressionRGBLow to mediumVariableVariableyesyesyesno (3)nopartial (2)
RGB 48 bitUncompressed RGB, very high precision. Converted to RGBA 64 bit for the GPURGBVery high48 disk, 64 GPU6 disk, 8 GPUyesyesyespartial (6)yesno
RGB 24 bitUncompressed RGB. Converted to RGBA 32 bit for the GPURGBHigh24 disk, 32 GPU3 disk, 4 GPUyesyesyesyesyesyes
RGB 16 bitQuantized RGBRGBMedium162yesyesyesyesyesyes
RG Compressed BC5Compressed two channel (RG)RGHigh81yesyesyesnonono
RG 32 bitUncompressed two channel (RG), very high precisionRGVery high324yesyesyespartial (6)yesno
R Compressed BC4Compressed single channel (R)RHigh40.5yesyesyesnonono
R 8Uncompressed single channel (R)RHigh81yesyesyespartial (5)yespartial (5)
R 16 bitUncompressed single channel (R), very high precisionRVery high162yesyesyespartial (6)partial (6)no
Alpha 8Uncompressed single channel (A)AHigh81yesyesyesyesyesyes
RGBA HalfHDR, half-precision (FP16) RGBA, –64k to +64k rangeRGBAHigh648yesyesyespartial (7)yespartial (7)
RGB Compressed BC6HHDR, compressed RGB, 0 to +64k rangeRGBHigh81yes (1)yes (1)yesnonono
RGB9e5 32 Bit Shared Exponent FloatHDR, quantized RGB, 0 to +64k rangeRGBMedium324yesyesyespartial (4)yespartial (4)
RGB(A) Compressed ASTCCompressed RGB or RGBA, size & quality dependent on block sizeRGB or RGBALow to high12×12: 0.89, 10×10: 1.28, 8×8: 2, 6×6: 3.56, 5×5: 5.12, 4×4: 812×12: 0.11, 10×10: 0.16, 8×8: 0.25, 6×6: 0.45, 5×5: 0.64, 4×4: 1.0nononopartial (8)yes (10)no
RGBA Compressed ETC2Compressed RGBARGBAMedium81nononopartial (9)yesno
RGBA Crunched ETC2Compressed RGBA, with additional on-disk Crunch compressionRGBALow to mediumVariableVariablenononopartial (9)yesno
RGB + 1-bit Alpha Compressed ETC2 4 bitsCompressed RGBA, with alpha values fully opaque or fully transparentRGBAMedium40.5nononopartial (9)yesno
RGBA Compressed PVRTC 4 bitsCompressed RGBA, texture required to be squareRGBAMedium40.5nononono (12)yesno
RGBA Compressed PVRTC 2 bitsCompressed RGBA, texture required to be squareRGBALow20.25nononono (12)yesno
RGB Compressed ETC2Compressed RGBRGBMedium40.5nononopartial (9)yesno
RGB Compressed ETCCompressed RGBRGBLow40.5nononoyesyesno
RGB Crunched ETCCompressed RGB, with additional on-disk Crunch compressionRGBLowVariableVariablenononoyesyesno
RGB Compressed PVRTC 4 bitsCompressed RGB, texture required to be squareRGBMedium40.5nononono (12)yesno
RGB Compressed PVRTC 2 bitsCompressed RGB, texture required to be squareRGBLow20.25nononono (12)yesno
RG Compressed EAC 8 bitCompressed two channel (RG)RGHigh81nononopartial (9)yesno
R Compressed EAC 4 bitCompressed single channel (R)RHigh40.5nononopartial (9)yesno
RGB(A) Compressed ASTC HDRHDR, compressed RGB or RGBA, size & quality dependent on block sizeRGB or RGBALow to High12×12: 0.89, 10×10: 1.28, 8×8: 2, 6×6: 3.56, 5×5: 5.12, 4×4: 812×12: 0.11, 10×10: 0.16, 8×8: 0.25, 6×6: 0.45, 5×5: 0.64, 4×4: 1.0nononopartial (11)partial (11)no

Notes:

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *