Android 2D Texture Overrides
This page details the Texture Overrides Platform-specific settings that allow you to set the resolution, file size with associated memory size requirements, pixel dimensions, and quality of your Textures for each target platform. More info
See in Glossary specific to Android. A description of the general Texture Overrides can be found here.
The information contained on this page assumes the reader has working knowledge of DXT and ETC Texture compression A method of storing data that reduces the amount of storage space it requires. See Texture Compression, Animation Compression, Audio Compression, Build Compression.
See in Glossary , OpenGL ES, and Android development.
Further information about Texture compression 3D Graphics hardware requires Textures to be compressed in specialised formats which are optimized for fast Texture sampling. More info
See in Glossary and OpenGL ES can be found on the following Wikipedia pages:
- DXT Texture compression
- ETC (Ericsson Texture Compression)
- Lossy compression
- OpenGL ES
Android 2D Texture Override settings in the Texture’s Inspector window. Click the Android logo to access Android-specific overrides.
Texture format A file format for handling textures during realtime rendering by 3D graphics hardware, such as a graphics card or mobile device. More info See in Glossary | Internal representation |
---|---|
RGB Compressed DXT1 | Compressed RGB texture. Supported by NVIDIA Tegra. 4 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 (32 KB for a 256×256 texture). |
RGB Crunched DXT1 | Compressed RGB Texture. Supported by NVIDIA Tegra. Crunch is a lossy compression format on top of DXT Texture compression. Textures are decompressed to DXT1 by the CPU and then uploaded to the GPU at runtime. Crunch produces smaller Textures than by regular DXT1 compression, but with lower quality. Crunch Textures can take a long time to compress, but decompression at runtime is very fast. 4 bits per pixel (output size varies depending on the Texture — from 1 KB for a 256×256 Texture). |
RGBA Compressed DXT5 | Compressed RGBA texture. Supported by NVIDIA Tegra. 8 bits per pixel (64 KB for a 256×256 texture). |
RGBA Crunched DXT5 | Compressed RGBA Texture. Supported by NVIDIA Tegra. Crunch is a lossy compression format on top of DXT Texture compression. Textures are decompressed to DXT5 on the CPU and then uploaded to the GPU at runtime. Crunch compression can be used to produce significantly smaller Textures than by regular DXT5 compression, but with lower quality. Crunch Textures can take a long time to compress, but decompression at runtime is very fast. 8 bits per pixel (output size varies depending on the Texture — from 1 KB for a 256×256 Texture). |
RGB Compressed ETC 4 bits | Compressed RGB Texture. This is the default Texture format for Android projects in Unity. ETC_RGB4 is a part of OpenGL ES 2.0 and is supported by all OpenGL ES 2.0 GPUs. It does not support alpha. 4 bits per pixel (32 KB for a 256×256 Texture). |
RGB Crunched ETC | Compressed RGB Texture. Crunch is a lossy compression format on top of ETC Texture compression. Textures are decompressed to ETC_RGB4 by the CPU and then uploaded to the GPU at runtime. Crunch produces smaller Textures than by regular ETC_RGB4 compression, but with lower quality. Crunch Textures can take a long time to compress, but decompression at runtime is very fast. ETC_RGB4 is a part of OpenGL ES 2.0 and is supported by all OpenGL ES 2.0 GPUs. It does not support alpha. 4 bits per pixel (output size varies depending on the Texture — from 1 KB for a 256×256 Texture). |
RGB Compressed ETC2 4 bits | Compressed RGB Texture. ETC2 is a part of OpenGL ES 3.0 and is supported by all OpenGL ES 3.0 GPUs. 4 bits per pixel (32 KB for a 256×256 Texture). |
RGB + 1-bit Alpha Compressed ETC2 4 bits | Compressed RGB Texture with 1-bit punchthrough alpha. ETC2 is a part of OpenGL ES 3.0 and is supported by all OpenGL ES 3.0 GPUs. 4 bits per pixel (32 KB for a 256×256 Texture). |
RGBA Compressed ETC2 8 bits | Compressed RGBA Texture. Supported by all OpenGL ES 3.0 GPUs. (64 KB for a 256×256 Texture) |
RGBA Crunched ETC2 | Compressed RGBA Texture. Crunch is a lossy compression format on top of ETC Texture compression. Textures are decompressed to ETC2_RGBA8 on the CPU and then uploaded to the GPU at runtime. Crunch compression can be used to produce significantly smaller Textures than by regular ETC2_RGBA8 compression, but with lower quality. Crunch Textures can take a long time to compress, but decompression at runtime is very fast. Supported by all OpenGL ES 3.0 GPUs. 8 bits per pixel (output size varies depending on the Texture — from 1 KB for a 256×256 Texture). |
RGB Compressed PVRTC__ 2 bits__ | Compressed RGB Texture. Supported by Imagination PowerVR GPUs. 2 bits per pixel (16 KB for a 256×256 Texture) |
RGBA Compressed PVRTC 2 bits | Compressed RGBA Texture. Supported by Imagination PowerVR GPUs. 2 bits per pixel (16 KB for a 256×256 Texture) |
RGB Compressed PVRTC 4 bits | Compressed RGB Texture. Supported by Imagination PowerVR GPUs. 4 bits per pixel (32 KB for a 256×256 Texture) |
RGBA Compressed PVRTC 4 bits | Compressed RGBA Texture. Supported by Imagination PowerVR GPUs. 4 bits per pixel (32 KB for a 256×256 Texture) |
RGB Compressed ATC__ 4 bits__ | Compressed RGB Texture. Supported by Qualcomm Snapdragon. 4 bits per pixel (32 KB for a 256×256 Texture). |
RGBA Compressed ATC 8 bits | Compressed RGBA Texture. Supported by Qualcomm Snapdragon. 8 bits per pixel (64 KB for a 256×256 Texture). |
RGB Compressed ASTC 4×4 block RGB Compressed ASTC 5×5 block RGB Compressed ASTC 6×6 block RGB Compressed ASTC 8×8 block RGB Compressed ASTC 10×10 block RGB Compressed ASTC 12×12 block | Compressed RGB Texture. Supported by all OpenGL ES 3.2 and OpenGL ES 3.1+AEP GPUs, as well as by some OpenGL ES 3.0 GPUs. This compression type uses fixed 128-bit block size, and depending on the pixel block size (4×4 to 12×12), it may utilize 8 to 0.89 bits per pixel. The size of the compressed Texture varies from 64 KB for a 256×256 Texture (4×4 block, highest quality) to 7.6 KB for a 256×256 Texture (12×12 block, highest compression rate). |
RGBA Compressed ASTC 4×4 block RGBA Compressed ASTC 5×5 block RGBA Compressed ASTC 6×6 block RGBA Compressed ASTC 8×8 block RGBA Compressed ASTC 10×10 block RGBA Compressed ASTC 12×12 block | Compressed RGBA Texture. Supported by all OpenGL ES 3.2 and OpenGL ES 3.1+AEP GPUs, as well as by some OpenGL ES 3.0 GPUs. This compression type uses fixed 128-bit block size, and depending on the pixel block size (4×4 to 12×12), it may utilize 8 to 0.89 bits per pixel. The size of the compressed Texture varies from 64 KB for a 256×256 Texture (4×4 block, highest quality) to 7.6 KB for a 256×256 Texture (12×12 block, highest compression rate). |
RGB 16 bit | 65 thousand colors with no alpha. Uses more memory than the compressed formats, but could be more suitable for UI (User Interface) Allows a user to interact with your application. More info See in Glossary or crisp Textures without gradients. 128 KB for a 256×256 Texture. |
RGB 24 bit | Truecolor but without alpha. 192 KB for a 256×256 Texture. |
Alpha 8 bit | High quality alpha channel but without any color. 64 KB for a 256×256 Texture. |
RGBA 16 bit | Low-quality truecolor. The default compression for the Textures with alpha channel. 128 KB for a 256×256 Texture. |
RGBA 32 bit | Truecolor with alpha — this is the highest quality compression for the Textures with alpha. 256 KB for a 256×256 Texture. |
Compression quality | Choose Fast for quickest performance, Best for the best image quality and Normal for a balance between the two. |
If your app is installed on a device that doesn’t support the Texture compression format it uses, Unity decompresses the Textures to RGBA 32 and store them in the device’s memory, along with the compressed Textures, while the app is running. This leads to increased loading times and higher memory usage, because Unity must decompress the Textures and store two versions of the Textures used (compressed and uncompressed). This can also have a large impact on rendering The process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
See in Glossary performance, especially on older, slower devices.
Use ETC2 compression unless your app targets specific hardware like the Nvidia Tegra. ETC2 supports Textures with and without an alpha channel, and all OpenGL ES 3 devices support it. To avoid software decompression, follow these steps:
- Open the Android Player settings (menu: Edit >Project Settings A broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your Project behave. More info
See in Glossary >Player Settings Settings that let you set various player-specific options for the final game built by Unity. More info
See in Glossary ). - In the Other Settings section, remove OpenGL ES 2 from the Graphics APIs list. This sets the minimum graphics API to OpenGL ES 3.
- In the Other Settings section, set the Minimum API Level to Android 4.4 ‘KitKat’ (API level 19).
To target OpenGL ES 2 and OpenGL ES 3 devices, you can create and publish two different APKs The Android Package format output by Unity. An APK is automatically deployed to your device when you select File > Build & Run. More info
See in Glossary . Follow these steps:
- Build an APK that targets OpenGL ES 3, using the Player settings in the screenshot above.
- Build a separate APK that targets OpenGL ES 2. To do this, remove OpenGL ES 3 and Vulkan from the Graphics APIs section of the Player settings.
- Publish both of these APKs to the Google Play Store. When a user downloads your app, the Google Play Store automatically installs the most relevant APK for their device.
For more information about publishing multiple APK files, see Android Developer documentation on:
When building an APK that targets OpenGL ES 2, you can use ETC1 texture compression.
The Texture compression format for OpenGL ES2-targeted APKs can be ETC1. Unity can use ETC1 for Textures with Alpha, provided they are placed on 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 (by specifying the packing tag) and the build is for Android. You can opt in for this by setting the Compress using ETC1 checkbox for the Texture. Unity then splits the resulting atlas into two Textures, each without alpha, and then combines them in the final parts of the render pipeline.
If you must store an alpha channel in a Texture, all hardware vendors support the RGBA 16 bit compression format.
2017–09–18 Page amended
Updated feature in Unity 2017.1
Crunch compression format updated in Unity 2017.3
Источник
Render Texture
A Render Texture is a type of Texture An image used when rendering a GameObject, Sprite, or UI element. Textures are often applied to the surface of a mesh to give it visual detail. More info
See in Glossary that Unity creates and updates at run time. To use a Render Texture, create a new Render Texture using Assets > Create > Render Texture and assign it to Target Texture in your Camera A component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary component. Then you can use the Render Texture in a Material An asset that defines how a surface should be rendered. More info
See in Glossary just like a regular Texture.
Properties
The Render Texture inspector A Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary is similar to the Texture Inspector.
The Render Texture Inspector is almost identical to the Texture Inspector
The Render Texture inspector displays the current contents of Render Texture in realtime and can be an invaluable debugging tool for effects that use render textures.
Property: | Function: | |
---|---|---|
Dimension | The dimensionality (type) of the render texture. | |
2D | The render texture is two-dimensional. | |
Cube | The render texture is a cube map. | |
3D | The render texture is three-dimensional. | |
Size | The size of the render texture in pixels 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 . You can only enter power-of-two values, such as 128 and 256. | |
Anti-Aliasing | The number of anti-aliasing samples. You can select None, 2 samples, 4 samples, or 8 samples. If you select None, Unity does not apply anti-aliasing. | |
Enable Compatible Color Format | Enable this checkbox to make Unity apply a compatible format to the render texture if the defined Color Format is not supported by the platform. | |
Color Format | The color format of the render texture. | |
Depth Buffer | The format of the depth buffer. You can select No depth buffer, At least 16 bits depth (no stencil), or At least 24 bits depth (with stencil). The stencil buffer is a general purpose buffer that allows you to store an additional unsigned 8-bit integer (0–255) for each pixel drawn to the screen. | |
Enable Mip Maps | Check this box to make the render texture generate mipmaps. | |
Auto generate Mip Maps | Check this box to automatically fill the generated mipmaps with relevant data. If you don’t enable this, you’ll have to use the GenerateMips function to fill those mipmaps manually. Alternatively, choose which mip to render into when you call the various SetRenderTarget functions. For more information about the SetRenderTarget functions, see Graphics.SetRenderTarget and Rendering.CommandBuffer.SetRenderTarget . | |
Dynamic Scaling | Check this box to let dynamic resolution scaling resize the render texture. If you don’t enable this, the render texture maintains the same size regardless of the Dynamic Resolution A Camera setting that allows you to dynamically scale individual render targets, to reduce workload on the GPU. More info See in Glossary setting. | |
Wrap Mode | Controls how the texture is wrapped: | |
Repeat | Tiles the texture to create a repeating pattern. | |
Clamp | Stretches the edges of the texture. This is useful for preventing wrapping artifacts when you map an image onto an object and you don’t want the texture to tile. | |
Mirror | Tiles the texture to create a repeating pattern that mirrors the texture at every integer boundary. | |
Mirror Once | Mirrors the texture once, and then falls back to clamping. | |
Per-axis | Lets you set different wrap modes for the U axis and the V axis. The available options are also Repeat, Clamp, Mirror and Mirror Once. For example, when you use latitude-longitude environment maps for reflection probes A rendering component that captures a spherical view of its surroundings in all directions, rather like a camera. The captured image is then stored as a Cubemap that can be used by objects with reflective materials. More info See in Glossary , it is useful to have Clamp on the vertical coordinate (V axis), but Repeat on the horizontal coordinate (U axis). | |
Filter Mode | Controls how the sampling of the texture uses nearby pixels. The options are: | |
Point | Uses the nearest pixel. This makes the texture appear pixelated. | |
Bilinear | Uses a weighted average of the four nearest texels. This makes the texture appear blurry when you magnify it. | |
Trilinear | Uses a weighted average of the two nearest mips, which are bilinearly filtered. This creates a soft transition between mips, at the cost of a slightly more blurry appearance. | |
Aniso Level The anisotropic filtering (AF) level of a texture. Allows you to increase texture quality when viewing a texture at a steep angle. Good for floor and ground textures. More info See in Glossary | Anisotropic filtering level of the texture. This increases texture quality when you view the texture at a steep angle. Good for floor, ground, or road textures. |
Example
To create a live arena camera in your game:
- Create a new Render Texture asset using Assets >Create >Render Texture.
- Create a new Camera using GameObject > Camera.
- Assign the Render Texture to the Target Texture of the new Camera.
- Create a new 3D cube using GameObject > 3D Object > Cube.
- Drag the Render Texture onto the cube to create a Material that uses the render texture.
- Enter Play Mode, and observe that the cube’s texture is updated in real-time based on the new Camera’s output.
Render Textures are set up as demonstrated above
2019–04–11 Page amended
Render Texture inspector changed in Unity 2017.2
Ability to apply any GPU format to Render Textures added in Unity 2019.1
Источник