Skip to content

Commit 5074a2a

Browse files
committed
更新文档中有关压缩纹理的描述错误与漏洞,修改中文文档的新手上路为新手入门
1 parent af56e34 commit 5074a2a

File tree

27 files changed

+231
-114
lines changed

27 files changed

+231
-114
lines changed

versions/2.4/en/asset-workflow/compress-texture.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Texture Compression
22

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.
415
516
## Configuring Texture Compression
617

@@ -11,21 +22,38 @@ For example, on the mobile platform may only need the original image 80% or less
1122
Before Cocos Creator v2.4, texture compression configuration was only supported on **Android**, **iOS**, **Web** and **WeChat Mini Game** platforms.
1223
Starting with v2.4, texture compression configuration is supported on all mini game platforms.
1324

14-
| Picture Format | Android | iOS | Mini Game | Web |
15-
| :----------- | :------------ | :-------- | :------- | :------- |
16-
| PNG | Support | Support | Support | Support |
17-
| JPG | Support | Support | Support | Support |
18-
| 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) |
19-
| PVR | Unsupport | Support iOS | Unsupport | Unsupport |
20-
| 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 |
26+
| :----------- | :------ | :-- | :--------- | :-- | :------ | :-- |
27+
| PNG | Supported | Supported | Supported | Supported | Supported | Supported |
28+
| JPG | Supported | Supported | Supported | Supported | Supported | Supported |
29+
| 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 |
2434

2535
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**.
2636

2737
![compress-texture](compress-texture/compress-texture.png)
2838

39+
### Compressed Texture Support Details for Each Mobile Platform
40+
41+
In addition to `JPG` and `PNG` which are supported across all platforms, the support for other texture compression formats is as follows:
42+
43+
| Platform Name | Supported Compression Formats |
44+
| :------------ | :---------------------------- |
45+
| Web Mobile | ASTC / ETC1 / ETC2 / PVR / WEBP |
46+
| WeChat Mini Game | ASTC / ETC1 / ETC2 / PVR |
47+
| ByteDance Mini Game | ASTC / ETC1 / ETC2 / PVR |
48+
| Alipay Mini Game | ASTC / ETC1 / PVR |
49+
| Taobao Mini Game | ASTC / ETC1 / PVR |
50+
| OPPO Mini Game | ETC1 |
51+
| vivo Mini Game | ETC1 / ASTC |
52+
| Huawei Quick Game | ETC1 |
53+
| Xiaomi Quick Game | ETC1 |
54+
| iOS | ASTC / ETC1 / ETC2 / PVR / WEBP |
55+
| Android / Huawei AGC | ASTC / ETC1 / ETC2 / WEBP |
56+
2957
## Texture Compression Details
3058

3159
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.

versions/2.4/zh/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 新手入门
44

5-
- [新手上路](getting-started/index.md)
5+
- [新手入门](getting-started/index.md)
66
- [关于 Cocos Creator](getting-started/introduction.md)
77
- [安装和启动](getting-started/install.md)
88
- [使用 Dashboard](getting-started/dashboard.md)

versions/2.4/zh/asset-workflow/compress-texture.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,56 @@
11
# 压缩纹理
22

3-
Cocos Creator 可以直接在编辑器中设置纹理需要的压缩方式,然后在项目发布时自动对纹理进行压缩。针对 Web 平台,支持同时导出多种图片格式,引擎将根据不同的浏览器自动下载合适的格式。
3+
Cocos Creator 可以直接在编辑器中设置纹理需要的压缩方式,然后在项目发布时自动对纹理进行压缩。支持同一平台同时导出多种图片格式,引擎将根据设备对压缩纹理格式的支持情况加载合适的压缩纹理。
4+
5+
## 压缩纹理的优势
6+
7+
* 对于 png、jpg、webp 等压缩纹理
8+
- 通过配置压缩纹理能够在构建项目时压缩纹理像素数据减少资源体积,提高游戏的资源下载速度。
9+
* 对于 astc、etc1、etc2、pvrtc 等 GPU 压缩纹理
10+
- 通过配置压缩纹理能够在构建项目时将纹理像素数据转化为GPU专用的压缩格式,这些格式可以直接在GPU内存中使用,无需运行时解压,从而显著减少内存占用、降低带宽需求,提高游戏的渲染性能和加载速度。
11+
12+
> **注意**
13+
> * png、jpg、webp 等非 GPU 压缩纹理格式的图片资源,在压缩图片质量后并不能减少解码图片资源的时间以及减少游戏的内存。
14+
> * 压缩 png、jpg、webp 等格式图片使用的是 [sharp](https://github.com/lovell/sharp) 开源库,它的压缩率稍低于 [tinypng](https://tinypng.com/) 并且可能出现压缩后图片更大的情况,如果你需要优化此问题,建议使用 [自定义插件](../extension/index.md) 自行解决此问题。
415
516
## 配置压缩纹理
617

718
Cocos Creator 支持导入多种格式的图片(具体见下表),但是在实际游戏运行中,我们不建议使用原始图片作为资源来加载。比如在手机平台上可能只需要原图 80% 或者更少的画质,又或者是没有使用到透明通道的 `.png` 可以将其转换成 `.jpg`,这样可以减少很大一部分图片的存储空间。
819

920
在 Cocos Creator v2.4 之前,配置压缩纹理只支持 **Android****iOS****Web****微信小游戏** 平台,而从 v2.4 开始,支持所有的小游戏平台。
1021

11-
| 图片格式 | Android | iOS | Mini Game | Web |
12-
| :----------- | :------------ | :-------- | :------- | :------- |
13-
| PNG | 支持 | 支持 | 支持 | 支持 |
14-
| JPG | 支持 | 支持 | 支持 | 支持 |
15-
| WEBP | Android 4.0 以上原生支持<br>其他版本可以使用 [解析库](https://github.com/alexey-pelykh/webp-android-backport) | 可以使用 [解析库](https://github.com/carsonmcdonald/WebP-iOS-example) | 不支持 | [部分支持](https://caniuse.com/#feat=webp) |
16-
| PVR | 不支持 | 支持 | 支持 iOS 设备 | 支持 iOS 设备 |
17-
| ETC1 | 支持 | 不支持 | 支持 Android 设备 | 支持 Android 设备 |
18-
| ETC2 | 只支持生成资源,引擎部分需要参考 PR [#1685](https://github.com/cocos/engine-native/pull/1685) 自己实现。 | 只支持生成资源,引擎部分需要参考 PR [#1685](https://github.com/cocos/engine-native/pull/1685) 自己实现。 | - | - |
19-
| ASTC | 部分支持 | 部分支持 | 不支持(iOS 版微信小游戏 v8.0.3 以上支持) | 部分支持 |
22+
| 图片格式 | Android | iOS | 小游戏 | Web | Windows | Mac
23+
| :------ | :------ | :------ | :----- | :------ | :----- | :------ |
24+
| PNG | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
25+
| JPG | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
26+
| WEBP | Android 4.0 以上原生支持其他版本可以使用 [解析库](https://github.com/alexey-pelykh/webp-android-backport) | 可以使用 [解析库](https://github.com/carsonmcdonald/WebP-iOS-example) | 支持 | [部分支持](https://caniuse.com/#feat=webp) | 不支持 | 不支持 |
27+
| PVR | 不支持 | 支持 | 支持 iOS 设备 | 支持 iOS 设备 | 不支持 | 不支持 |
28+
| ETC1 | 支持 | 不支持 | 支持 Android 设备 | 支持 Android 设备 | 不支持 | 不支持 |
29+
| ETC2 | 部分支持,取决于手机硬件 | 不支持 | 不支持 | 支持部分 Android 设备 | 不支持 | 不支持 |
30+
| ASTC | 支持(Android 5.0+) | 支持(iOS 9.0+/iPhone6+) | 微信、抖音、阿里、淘宝等平台支持,详情请看[各平台压缩纹理支持详情](#各移动平台压缩纹理支持详情)。注:开发者工具不支持,需真机调试 | 部分支持 | 不支持 | 不支持 |
2031

2132
默认情况下 Cocos Creator 在构建的时候输出的是原始图片,如果在构建时需要对某一张图片进行压缩,可以在 **资源管理器** 中选中这张图片,然后在 **属性管理器** 中对图片的纹理格式进行编辑。
2233

2334
![compress-texture](compress-texture/compress-texture.png)
2435

36+
### 各移动平台压缩纹理支持详情
37+
38+
除全平台支持的 `JPG``PNG` 外,其他纹理压缩格式的支持情况如下:
39+
40+
| 平台名称 | 支持的压缩格式 |
41+
| :---------------- | :------------------- |
42+
| Web Mobile | ASTC / ETC1 / ETC2 / PVR / WEBP |
43+
| WeChat Mini Game | ASTC / ETC1 / ETC2 / PVR |
44+
| ByteDance Mini Game | ASTC / ETC1 / ETC2 / PVR |
45+
| AliPay Mini Game | ASTC / ETC1 / PVR |
46+
| TaoBao Mini Game | ASTC / ETC1 / PVR |
47+
| OPPO Mini Game | ETC1 |
48+
| vivo Mini Game | ETC1 / ASTC |
49+
| Huawei Quick Game | ETC1 |
50+
| Xiaomi Quick Game | ETC1 |
51+
| iOS | ASTC / ETC1 / ETC2 / PVR / WEBP |
52+
| Android / Huawei AGC | ASTC / ETC1 / ETC2 / WEBP |
53+
2554
## 压缩纹理详解
2655

2756
Cocos Creator 在构建图片的时候,会查找当前图片是否在某平台配置了压缩纹理:

versions/2.4/zh/summary.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"collapsed": false,
55
"items": [
66
{
7-
"text": "新手上路",
7+
"text": "新手入门",
88
"link": "getting-started/index.md",
99
"items": [
1010
{

versions/3.0/zh/getting-started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 新手上路
1+
# 新手入门
22

33
欢迎使用 Cocos Creator,在学习使用之前,请先参考 [安装和启动](install/index.md) 安装好 Cocos Creator。
44

versions/3.1/zh/getting-started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 新手上路
1+
# 新手入门
22

33
欢迎使用 Cocos Creator,在学习使用之前,请先参考 [安装和启动](install/index.md) 安装好 Cocos Creator。
44

versions/3.2/zh/getting-started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 新手上路
1+
# 新手入门
22

33
欢迎使用 Cocos Creator,在学习使用之前,请先参考 [安装和启动](install/index.md) 安装好 Cocos Creator。
44

versions/3.3/zh/getting-started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 新手上路
1+
# 新手入门
22

33
欢迎使用 Cocos Creator,在学习使用之前,请先参考 [安装和启动](install/index.md) 安装好 Cocos Creator。
44

versions/3.4/zh/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## 基础使用
66

7-
- [新手上路](getting-started/index.md)
7+
- [新手入门](getting-started/index.md)
88
- [关于 Cocos Creator](getting-started/introduction/index.md)
99
- [安装和启动](getting-started/install/index.md)
1010
- [使用 Dashboard](getting-started/dashboard/index.md)

versions/3.4/zh/getting-started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 新手上路
1+
# 新手入门
22

33
欢迎使用 Cocos Creator,在学习使用之前,请先参考 [安装和启动](install/index.md) 安装好 Cocos Creator。
44

0 commit comments

Comments
 (0)