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
+40-15Lines changed: 40 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -5,27 +5,27 @@ requireMSLicense: false
5
5
---
6
6
7
7
The Android ecosystem is unique in that the hardware it runs on can be from many different manufactures.
8
-
Unlike iOS or PC you cannot always guarentee what graphics card a user will be using. For this reason
9
-
Android needs to have some special attention when shipping your game.
8
+
Unlike iOS or PC you cannot always guarantee what graphics card a user will be using. For this reason
9
+
Android needs to have some special attention when shipping your game.
10
10
11
11
## Texture Compression
12
12
13
13
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.
14
14
The graphics cards on mobile phones do not have the same kind of capabilities as those on the PC or Consoles.
15
15
They regularly have less memory and less power. So you need to make use of what you have in a more efficient way.
16
16
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
17
-
textures on the graphics card than you could if you just used raw RGBA textures.
17
+
textures on the graphics card than you could if you just used raw `RGBA` textures.
18
18
19
19
## How Android deals with textures
20
20
21
-
Fortunately the Android engineers recognised that supporting all of these texture compresison formats
22
-
was not an easy task. So with the introduction of the `.aab` file format they added the ability to
21
+
Fortunately the Android engineers recognized that supporting all of these texture compression formats
22
+
was not an easy task. So with the introduction of the `.aab` file format they added the ability to
23
23
add multiple texture format files to the package. The way the `.aab` works is that it is not the final
24
-
`.apk`. The final `.apk` will be built from the `.aab` when the game is delivered to the end user device.
24
+
`.apk`. The final `.apk` will be built from the `.aab` when the game is delivered to the end user device.
25
25
As a result not all of the files in the `.aab` will make it to the device. It will filter out things like
26
-
`.so` files for other cpu types, and yes, texture formats.
26
+
`.so` files for other cpu types, and yes, texture formats.
27
27
28
-
The `.aab` supports the following directory suffixes for texture compresison
28
+
The `.aab` supports the following directory suffixes for texture compression
29
29
30
30
| Texture Format | Suffix |
31
31
| -------------- | ------ |
@@ -37,9 +37,9 @@ The `.aab` supports the following directory suffixes for texture compresison
37
37
| ETC1 | #tcf_etc1 |
38
38
| ETC2 | #tcf_etc2 |
39
39
40
-
see https://developer.android.com/guide/playcore/asset-delivery/texture-compression
40
+
see [https://developer.android.com/guide/playcore/asset-delivery/texture-compression](https://developer.android.com/guide/playcore/asset-delivery/texture-compression)
41
41
42
-
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
42
+
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
43
43
you use when processing an image. This following table shows you how to map that to the Suffix
44
44
45
45
| TextureProcessorOutputFormat | Suffix |
@@ -54,10 +54,10 @@ you use when processing an image. This following table shows you how to map that
54
54
55
55
## Adding Texture Compression Suffixes
56
56
57
-
With the latest MonoGame we added support for being able to have one texture with multiple outputs.
58
-
Previously it would only build the last item, but this has been fixed.
57
+
With the latest MonoGame we added support for being able to have one texture with multiple outputs.
58
+
Previously it would only build the last item, but this has been fixed.
59
59
60
-
In the Content Editor
60
+
In the Content Editor
61
61
62
62
1. Add a new folder for your desired Suffix. This is usually in the form of `Textures<suffix>`.
63
63
2. Right click on the new folder and Add an Existing File.
@@ -71,14 +71,39 @@ 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
75
-
an optional `<destination_filepath>` after the `<content_filepath>`. We can use this to provide the target folder for our output.
74
+
As documented the [/build](https://docs.monogame.net/articles/getting_started/tools/mgcb.html#build-content-file) command takes an optional `<destination_filepath>` after the `<content_filepath>`. We can use this to provide the target folder for our output.
76
75
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`.
77
76
78
77
> !Important
79
78
> Some texture formats have specific size requirements. For example PVRTC Compressed Textures MUST be a Power of 2 and Square (e.g 1024x1024).
80
79
> Many others need to be Power of 2. It is recommended that you make all your textures Power of 2 just to make life easier.
81
80
81
+
## Supporting Multiple Texture Compression Types
82
+
83
+
To allow your game to work on as many devices as possible we need to support multiple compression formats. Now that we know how to specify a specific texture compression format for a texture, how do we go about supporting multiple formats? It is really quite simple. We can duplicate the entry for each texture an specify a different `/processorParam:TextureFormat` and output path. For example the following code is how we would build both `pcrtc` and `dxt` formats.
84
+
85
+
```bash
86
+
#begin Textures/LogoOnly_64px.png for PvrCompressed
0 commit comments