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: articles/getting_to_know/howto/content_pipeline/HowTo_PackageTextures_On_Android.md
+87-2Lines changed: 87 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,92 @@ Android needs to have some special attention when shipping your game.
6
6
7
7
## Texture Compression
8
8
9
-
As stated in [Texture Compress.md] you need to be aware of the performance limitations on mobile devices.
9
+
As stated in "[Why use the Content Pipeline](https://docs.monogame.net/articles/getting_started/content_pipeline/why_content_pipeline.html)" you need to be aware of the performance limitations on mobile devices.
10
10
The graphics cards on mobile phones do not have the same kind of capabilities as those on the PC or Consoles.
11
11
They regularly have less memory and less power. So you need to make use of what you have in a more efficient way.
12
-
One of these ways is to use Texture Compression. As stated in [Texture Compress.md] this allows you to fit more
12
+
One of these ways is to use Texture Compression. As stated in "[Why use the Content Pipeline](https://docs.monogame.net/articles/getting_started/content_pipeline/why_content_pipeline.html)" this allows you to fit more
13
13
textures on the graphics card than you could if you just used raw RGBA textures.
14
14
15
+
## How Android deals with textures
16
+
17
+
Fortunately the Android engineers recognised that supporting all of these texture compresison formats
18
+
was not an easy task. So with the introduction of the `.aab` file format they added the ability to
19
+
add multiple texture format files to the package. The way the `.aab` works is that it is not the final
20
+
`.apk`. The final `.apk` will be built from the `.aab` when the game is delivered to the end user device.
21
+
As a result not all of the file in the `.aab` will make it to the device. It will filter out things like
22
+
`.so` files for other cpu types, and yes, texture formats.
23
+
24
+
The `.aab` supports the following directory suffixes for texture compresison
25
+
26
+
| Texture Format | Suffix |
27
+
| -------------- | ------ |
28
+
| PVRTC | #tcf_pvrtc |
29
+
| ATC | #tcf_atc |
30
+
| ASTC| #tcf_astc |
31
+
| S3TC | #tcf_s3tc |
32
+
| DXT1 | #tcf_dxt1 |
33
+
| ETC1 | #tcf_etc1 |
34
+
| ETC2 | #tcf_etc2 |
35
+
36
+
see https://developer.android.com/guide/playcore/asset-delivery/texture-compression
37
+
38
+
MonoGame has its own [TextureProcessorOutputFormat](https://docs.monogame.net/api/Microsoft.Xna.Framework.Content.Pipeline.Processors.TextureProcessorOutputFormat.html) enumeration which describes the type of Texture Compression
39
+
you use when processing an image. This following table shows you how to map that to the Suffix
40
+
41
+
| TextureProcessorOutputFormat | Suffix |
42
+
| -------------- | ------ |
43
+
| PvrCompressed | #tcf_pvrtc |
44
+
| AtcCompressed | #tcf_atc |
45
+
| AstcCompressed| #tcf_astc |
46
+
| DxtCompressed | #tcf_s3tc |
47
+
| Etc1Compressed | #tcf_etc1 |
48
+
| EtcCompressed | #tcf_etc2 |
49
+
| Compressed | No Suffix |
50
+
51
+
## Adding Texture Compression Suffixes
52
+
53
+
With the latest MonoGame we added support for being able to have one texture with multiple outputs.
54
+
Previously it would only build the last item, but this has been fixed.
55
+
56
+
In the Content Editor
57
+
58
+
1. Add a new folder for your desired Suffix. This is usually in the form of `Textures<suffix>`.
59
+
2. Right click on the new folder and Add an Existing File.
60
+
3. Select the file you want to use for this Suffix and Add it
61
+
4. In the Properties of the new file change the TextureFormat to be the one which matches the desired Suffix.
62
+
63
+
In the `.mgcb` file directly you can do the following
As documented the [/build](https://docs.monogame.net/articles/getting_started/tools/mgcb.html#build-content-file) command takes
71
+
an optional `<destination_filepath>` after the `<content_filepath>`. We can use this to provide the target folder for our output.
72
+
So in the example above, the `LogoOnly_64px.png` file will be compressed using `PvrCompressed` and then the output will end up in `Textures#tcf_pvrtc`.
73
+
74
+
> !Important
75
+
> Some texture formats have specific size requirements. For example PVRTC Compressed Textures MUST be a Power of 2 and Square (e.g 1024x1024).
76
+
> Many others need to be Power of 2. It is recommended that you make all your textures Power of 2
0 commit comments