- В недрах процесса построения Android сборки
- Сжатие текстур.
- Google Android Project
- Recommended, default, and supported texture compression formats, by platform
- Terminology
- Recommended texture compression formats, by platform
- Desktop
- iOS and tvOS
- Android
- Default texture compression formats, by platform
- Supported texture compression formats, by platform
В недрах процесса построения Android сборки
Сборка Android-приложения происходит в два этапа:
- Генерируется дистрибутив приложения (.apk-файл) со всеми необходимыми библиотеками и сериализованными ассетами.
- Пакет приложения разворачивается на текущем устройстве.
Кнопка “Build” в окне “Build settings” запускает лишь первый этап. Кнопка “Build and Run” выполняет оба этапа.
При первой сборке Android-проекта Unity попросит вас указать путь до Android SDK, требуемого для сборки и установки вашего Android приложения на устройство. Вы можете поменять его позже в Preferences .
При сборке приложения под Android убедитесь, что в настройках устройства включены “USB Debugging” и “Allow mock locations”.
Run the adb devices command found in your Android SDK/platform-tools folder, so that the operating system can see your device. This should work both for Mac and Windows.
Unity соберёт дистрибутив приложения (.apk-файл) и установит его на ваше подключенное устройство. Иногда ваше приложение не сможет запуститься само как на iPhone, и вам нужно будет разблокировать экран; в редких случаях вам придётся запустить только что установленное приложение из меню.
Сжатие текстур.
В Build Settings вы также найдёте опцию Texture Compression . По умолчанию, Unity использует ETC1/RGBA16 формат для текстур, которые не имеют индивидуальных переопределений (см. 2D текстуры / переопределения для платформ).
Если вы желаете собрать архив приложения (.apk файл), нацеленного на определённую архитектуру оборудования, вы можете использовать опцию Texture Compression для переопределения поведения по умолчанию. Все несжатые текстуры (с отключенным сжатием в настройках импортера) останутся без изменений; только текстуры со сжатым форматом будут использовать выбранный в Texture Compression формат.
Чтобы убедиться, что приложение разворачивается только на устройствах, поддерживающих выбранное сжатие текстур, Unity включит в AndroidManifest тэги, соответствующие выбранному формату. Это позволит механизму фильтрации Android Market’а предоставлять приложение только тем устройствам, у которых имеется соответствующее графическое оборудование.
Google Android Project
Generates a project which can be opened by Android Studio. Simply follow the steps:
- Download Android Studio.
- Export the project from Unity with Google Android project checkbox selected.
- Open Android Studio:
- File->Import Project. For ex., if you project was exported to C:\MyProjects, pick C:\MyProjects
Источник
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:
- Bits per pixel The smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
See in Glossary (bpp) is the amount of storage required for a single texture pixel. Textures with a lower bpp value have a smaller size on disk and in memory. A lower bpp value also means that the GPU can store more pixels in its cache, which results in faster texture access. - LDR (Low Dynamic Range) refers to most typical images where colors are conceptually between 0.0 (black) and 1.0 (white) values. The majority of image files (such as PNG and JPG) have low dynamic range.
- HDR high dynamic range
See in Glossary (High Dynamic Range) refers to special image and texture formats where colors can have a higher range than 0 through 1. Image file formats like .exr or .hdr are often used for HDR image data. At runtime and on the GPU, there are several HDR formats, trading off accuracy, range and memory usage. - RGB is a color model in which red, green and blue combine to reproduce an array of colors.
- RGBA is a version of RGB with an alpha channel, which supports blending and opacity alteration.
- Variable bit rate (VBR) means that bits per pixel is not a fixed value, and depends on the actual content instead. VBR only applies to Crunch compression, and only texture size on disk. The size in memory is the same as when using the underlying texture format (for example, RGB Compressed DXT1 for RGB Crunched DXT1).
Recommended texture compression formats, by platform
Desktop
For devices with DirectX 11 or better class GPUs, where support for BC7 and BC6H formats is guaranteed to be available, the recommended choice of compression formats is: RGB textures — DXT1 at four bits/pixel. RGBA textures — BC7 (higher quality, slower to compress) or DXT5 (faster to compress), both at eight bits/pixel. HDR textures — BC6H at eight bits/pixel. If you need to support DirectX 10 class GPUs on PC (NVIDIA GPUs before 2010, AMD before 2009, Intel before 2012), then DXT5 instead of BC7 would be preferred, since these GPUs do not support BC7 nor BC6H.
See the Supported texture compression formats reference table for detailed information about all supported formats.
iOS and tvOS
For Apple devices that use the A8 chip (2014) or above, ATSC is the recommended texture compression format for RGB and RGBA textures. This format allows you to choose between texture quality and size on a granular level: all the way from eight bits/pixel (4×4 block size) down to 0.89 bits/pixel (12×12 block size). If support for older devices is needed, or you want additional Crunch compression, then Apple devices support ETC/ETC2 formats starting with A7 chip (2013). For even older devices, PVRTC is the compression format to use. On iOS Apple’s mobile operating system. More info
See in Glossary , Unity’s default texture compression format is PVRTC, for the broadest possible compatibility. ASTC is preferred, but is not supported on A7 devices (the very first Metal-enabled devices) and will be unpacked at runtime.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 LDR RGB and RGBA textures, most modern Android GPUs support ASTC compression format, including: Qualcomm GPUs since Adreno 4xx / Snapdragon 415 (2015) ARM GPUs since Mali T624 (2012) NVIDIA GPUs since Tegra K1 (2014) PowerVR GPUs since GX6250 (2014) If you need support for older devices, or you want additional Crunch compression, then all GPUs that run Vulkan or Metal or OpenGL ES 3.0 support ETC2 format. The resulting image quality is quite high, and it supports one- to four-component texture data. OpenGL ES 2 devices do not support the ETC2 format, so Unity decompresses the texture at runtime to the format ETC2 fallback specifies. For even older devices, usually only ETC format is available. The drawback is that there is no direct alpha channel support. For Sprites A 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info
See in Glossary , Unity offers an option to use ETC1 compression by splitting a texture into two ETC1 textures: one for RGB, one for alpha. To enable this, enable the Android-specific Split Alpha Channel option for the Texture when importing a Sprite Atlas A texture that is composed of several smaller textures. Also referred to as a texture atlas, image sprite, sprite sheet or packed texture. More info
See in Glossary . The sprite shader A program that runs on the GPU. More info
See in Glossary samples both textures and combines them into the final result. For HDR textures, ASTC HDR is the only compressed format available on Android devices. ASTC HDR requires Vulkan or GL_KHR_texture_compression_astc_hdr support. ASTC is the most flexible format.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.
Platform Color model None Normal quality (default) High quality Low quality (higher performance) Windows, Linux, macOS RGB RGB 24 bit RGB Compressed DXT1 RGB(A) Compressed BC7 RGB Compressed DXT1 RGBA RGBA 32 bit RGBA Compressed DXT5 RGB(A) Compressed BC7 RGBA Compressed DXT5 HDR RGBA Half RGB Compressed BC6H RGB Compressed BC6H RGB 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 GlossaryRGB RGB 24 bit RGB Compressed DXT1 RGB Compressed DXT1 RGB Compressed DXT1 RGBA RGBA 32 bit RGBA Compressed DXT5 RGBA Compressed DXT5 RGBA Compressed DXT5 Android (only when Don’t override is enabled in the build settings) RGB RGB 24 bit RGB Compressed ETC RGB Compressed ETC RGB Compressed ETC RGBA RGBA 32 bit RGBA Compressed ETC2 RGBA Compressed ETC2 RGBA Compressed ETC2 iOS RGB RGB 24 bit RGB Compressed PVRTC 4 bits RGB Compressed PVRTC 4 bits RGB Compressed PVRTC 2 bits RGBA RGBA 32 bit RGBA Compressed PVRTC 4 bits RGBA Compressed PVRTC 4 bits RGBA Compressed PVRTC 2 bits tvOS RGB RGB 24 bit RGB Compressed ASTC 6×6 block RGB Compressed ASTC 4×4 block RGB Compressed ASTC 8×8 block RGBA RGBA 32 bit RGBA Compressed ASTC 6×6 block RGBA Compressed ASTC 4×4 block RGBA Compressed ASTC 8×8 block Default RGBA RGBA 32 bit RGBA 16 bit RGBA 16 bit RGBA 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 format Description Channels Quality Bits per pixel Size of 1024×1024 texture, in MB Windows Mac Linux Android iOS & tvOS WebGL RGB(A) Compressed BC7 Compressed RGB or RGBA RGB or RGBA High 8 1 yes (1) yes (1) yes no no no RGBA Compressed DXT5 Compressed RGBA (also known as BC3) RGBA Medium 8 1 yes yes yes no (3) no partial (2) RGBA Crunched DXT5 Compressed RGBA, with additional on-disk Crunch compression RGBA Low to medium Variable Variable yes yes yes no (3) no partial (2) RGBA 64 bit Uncompressed RGBA, very high precision RGBA Very high 64 8 yes yes yes partial (6) yes no RGBA 32 bit Uncompressed RGBA RGBA High 32 4 yes yes yes yes yes yes RGBA 16 bit Quantized RGBA RGBA Medium 16 2 yes yes yes yes yes yes RGB Compressed DXT1 Compressed RGB (also known as BC1) RGB Medium 4 0.5 yes yes yes no (3) no partial (2) RGB Crunched DXT1 Compressed RGB, with additional on-disk Crunch compression RGB Low to medium Variable Variable yes yes yes no (3) no partial (2) RGB 48 bit Uncompressed RGB, very high precision. Converted to RGBA 64 bit for the GPU RGB Very high 48 disk, 64 GPU 6 disk, 8 GPU yes yes yes partial (6) yes no RGB 24 bit Uncompressed RGB. Converted to RGBA 32 bit for the GPU RGB High 24 disk, 32 GPU 3 disk, 4 GPU yes yes yes yes yes yes RGB 16 bit Quantized RGB RGB Medium 16 2 yes yes yes yes yes yes RG Compressed BC5 Compressed two channel (RG) RG High 8 1 yes yes yes no no no RG 32 bit Uncompressed two channel (RG), very high precision RG Very high 32 4 yes yes yes partial (6) yes no R Compressed BC4 Compressed single channel (R) R High 4 0.5 yes yes yes no no no R 8 Uncompressed single channel (R) R High 8 1 yes yes yes partial (5) yes partial (5) R 16 bit Uncompressed single channel (R), very high precision R Very high 16 2 yes yes yes partial (6) partial (6) no Alpha 8 Uncompressed single channel (A) A High 8 1 yes yes yes yes yes yes RGBA Half HDR, half-precision (FP16) RGBA, –64k to +64k range RGBA High 64 8 yes yes yes partial (7) yes partial (7) RGB Compressed BC6H HDR, compressed RGB, 0 to +64k range RGB High 8 1 yes (1) yes (1) yes no no no RGB9e5 32 Bit Shared Exponent Float HDR, quantized RGB, 0 to +64k range RGB Medium 32 4 yes yes yes partial (4) yes partial (4) RGB(A) Compressed ASTC Compressed RGB or RGBA, size & quality dependent on block size RGB or RGBA Low to high 12×12: 0.89, 10×10: 1.28, 8×8: 2, 6×6: 3.56, 5×5: 5.12, 4×4: 8 12×12: 0.11, 10×10: 0.16, 8×8: 0.25, 6×6: 0.45, 5×5: 0.64, 4×4: 1.0 no no no partial (8) yes (10) no RGBA Compressed ETC2 Compressed RGBA RGBA Medium 8 1 no no no partial (9) yes no RGBA Crunched ETC2 Compressed RGBA, with additional on-disk Crunch compression RGBA Low to medium Variable Variable no no no partial (9) yes no RGB + 1-bit Alpha Compressed ETC2 4 bits Compressed RGBA, with alpha values fully opaque or fully transparent RGBA Medium 4 0.5 no no no partial (9) yes no RGBA Compressed PVRTC 4 bits Compressed RGBA, texture required to be square RGBA Medium 4 0.5 no no no no (12) yes no RGBA Compressed PVRTC 2 bits Compressed RGBA, texture required to be square RGBA Low 2 0.25 no no no no (12) yes no RGB Compressed ETC2 Compressed RGB RGB Medium 4 0.5 no no no partial (9) yes no RGB Compressed ETC Compressed RGB RGB Low 4 0.5 no no no yes yes no RGB Crunched ETC Compressed RGB, with additional on-disk Crunch compression RGB Low Variable Variable no no no yes yes no RGB Compressed PVRTC 4 bits Compressed RGB, texture required to be square RGB Medium 4 0.5 no no no no (12) yes no RGB Compressed PVRTC 2 bits Compressed RGB, texture required to be square RGB Low 2 0.25 no no no no (12) yes no RG Compressed EAC 8 bit Compressed two channel (RG) RG High 8 1 no no no partial (9) yes no R Compressed EAC 4 bit Compressed single channel (R) R High 4 0.5 no no no partial (9) yes no RGB(A) Compressed ASTC HDR HDR, compressed RGB or RGBA, size & quality dependent on block size RGB or RGBA Low to High 12×12: 0.89, 10×10: 1.28, 8×8: 2, 6×6: 3.56, 5×5: 5.12, 4×4: 8 12×12: 0.11, 10×10: 0.16, 8×8: 0.25, 6×6: 0.45, 5×5: 0.64, 4×4: 1.0 no no no partial (11) partial (11) no Notes:
- Except on pre-DX11 level GPUs, or macOS when using OpenGL. When not supported, BC6H textures get decompressed to RGBA Half, and BC7 get decompressed to RGBA32 at load time.
- With linear rendering on web browsers that do not support sRGB DXT, textures are decompressed to RGBA32 at load time.
- Except on Android devices with NVIDIA Tegra GPUs; these do support DXT/BC formats.
- Except on OpenGL ES 2.0 / WebGL 1.
- When on OpenGL ES 2.0 / WebGL 1: requires GL_EXT_texture_rg extension support.
- Requires GL_EXT_texture_norm16 or corresponding Vulkan capability on Android.
- When on OpenGL ES 2.0 / WebGL 1: requires OES_texture_half_float extension support.
- Requires Vulkan or GL_KHR_texture_compression_astc_ldr OpenGL ES extension.
- Except on OpenGL ES 2.0; there ETC2 textures are decompressed into the format ETC2 fallback specifies in the Android Build Settings or on the Android tab for the Platform-specific overrides.
- Except on Apple A7 chip devices (2013).
- Android: requires GL_KHR_texture_compression_astc_hdr extension. iOS: requires A13 or later chip (2019). When not supported, the texture is decompressed to RGB9E5 format, losing the alpha channel.
- Except on Android devices with Imagination PowerVR GPUs; these do support PVRTC formats.
Источник