You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versions/2.4/en/asset-workflow/compress-texture.md
+39-11Lines changed: 39 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,17 @@
1
1
# Texture Compression
2
2
3
-
Cocos Creator allows you to set the compression method required by the texture directly in the editor, and then automatically compress the texture when the project is published. For the Web platform, support for exporting multiple image formats at the same time, and the engine will automatically download the appropriate format according to different browsers.
3
+
Cocos Creator allows you to directly set the compression method for textures in the editor, and then automatically compresses textures during project publishing. It supports exporting multiple image formats for the same platform simultaneously, and the engine will load the appropriate compressed texture based on the device's support for compressed texture formats.
4
+
5
+
## Advantages of Compressed Textures
6
+
7
+
* For compressed textures like PNG, JPG, WEBP, etc.
8
+
- Configuring compressed textures allows compressing texture pixel data during project build to reduce resource size and improve game resource download speed.
9
+
* For GPU compressed textures like ASTC, ETC1, ETC2, PVRTC, etc.
10
+
- Configuring compressed textures allows converting texture pixel data into GPU-specific compressed formats during project build. These formats can be used directly in GPU memory without runtime decompression, significantly reducing memory usage, lowering bandwidth requirements, and improving game rendering performance and loading speed.
11
+
12
+
> **Note**:
13
+
> * For non-GPU compressed texture formats like PNG, JPG, WEBP, compressing image quality does not reduce the time to decode image resources or reduce game memory.
14
+
> * Compressing PNG, JPG, WEBP and other format images uses the [sharp](https://github.com/lovell/sharp) open source library. Its compression ratio is slightly lower than [tinypng](https://tinypng.com/) and may result in larger images after compression. If you need to optimize this issue, it is recommended to use [custom plugins](../extension/index.md) to solve it yourself.
4
15
5
16
## Configuring Texture Compression
6
17
@@ -11,21 +22,38 @@ For example, on the mobile platform may only need the original image 80% or less
11
22
Before Cocos Creator v2.4, texture compression configuration was only supported on **Android**, **iOS**, **Web** and **WeChat Mini Game** platforms.
12
23
Starting with v2.4, texture compression configuration is supported on all mini game platforms.
13
24
14
-
| Picture Format | Android | iOS | Mini Game | Web |
| WEBP | Android 4.0 above native support<br>Other versions can use the [resolver library](https://github.com/alexey-pelykh/webp-android-backport)| Use [resolver library](https://github.com/carsonmcdonald/WebP-iOS-example)| Unsupport |[resolver library](https://caniuse.com/#feat=webp)|
| PVR | Unsupport | Support | Support iOS | Support iOS |
21
-
| ETC1 | Support | Unsupport | Support Android | Support Android |
22
-
| ETC2 | Only support for generating resources, and the engine needs to be implemented by reference to PR [#1685](https://github.com/cocos/engine-native/pull/1685)| Only support for generating resources, and the engine needs to be implemented by reference to PR [#1685](https://github.com/cocos/engine-native/pull/1685)| - | - |
23
-
| ASTC | Partially Supported | Partially Supported | Not Supported (WeChat Mini Game v8.0.3 or above for iOS are supported.) | Partially Supported |
25
+
| Image Format | Android | iOS | Mini Games | Web | Windows | Mac |
| WEBP | Natively supported on Android 4.0+, other versions can use [parsing library](https://github.com/alexey-pelykh/webp-android-backport)| Can use [parsing library](https://github.com/carsonmcdonald/WebP-iOS-example)| Supported |[Partially supported](https://caniuse.com/#feat=webp)| Not supported | Not supported |
30
+
| PVR | Not supported | Supported | Supported on iOS devices | Supported on iOS devices | Not supported | Not supported |
31
+
| ETC1 | Supported | Not supported | Supported on Android devices | Supported on Android devices | Not supported | Not supported |
32
+
| ETC2 | Partially supported, depends on mobile hardware | Not supported | Not supported | Supported on some Android devices | Not supported | Not supported |
33
+
| ASTC | Supported (Android 5.0+) | Supported (iOS 9.0+/iPhone6+) | Supported on platforms like WeChat, Douyin, Alipay, Taobao, etc. For details, see [Compressed Texture Support Details for Each Platform](#Compressed-Texture-Support-Details-for-Each-Mobile-Platform). Note: Developer tools do not support, requires real device debugging | Partially supported | Not supported | Not supported |
24
34
25
35
By default, Cocos Creator outputs the original image when it is built. If you need to compress an image at build time, you can select this image in the **Assets** and edit the texture format in the **Properties**.
Cocos Creator will find out if the compressed texture is configured when the image is built, if not, continue to find out if the default configuration is made, and if not, output the original image.
0 commit comments