Hi there, i’m trying to use this new option, however, as soon as i tick the checkbox of the compressed sprite, it fallbacks again to ETC2.
ETC(default) is overriding in Build Settings aswell.
I am seeing this issue also, and confirm it is present in 5.2.0f3 that has just been released …
Yes. Is this feature even works? I’ve spent all day trying different approaches in packing asset bundles with different settings, but result is the same - all textures in ETC2.
Log messages looks like this:
Built-in Texture2D: SpriteAtlasTexture-map-2048x2048-fmt47
fmt47 is TextureFormat.ETC2_RGBA8.
The preview window (in the screenshot above) shows the state of the original texture.
ETC1 applies to the Atlas that is generated by Unity, and this can be seen using the SpritePacker window.
Example texture setup to use ETC1 compression (Packing tag, Override for Android, Compress using ETC1)
Sprite Packer view of generated atlas (no alpha in the atlas) + Compressed with ETC 4 bits
In game view of Texture using ETC1 compression
ETC1 for android is explained here http://docs.unity3d.com/Manual/class-TextureImporterAndroid.html
sandboxed,
Hi. Have you really tried this on a real Android device? Because what I see is this ugly non-alpha ETC compressed texture.
When Texture Compression is set to “Don’t override”, atlas get compressed to ETC2, NOT ETC1. I assuming this by looking at Editor.log:
- Packing atlas (spp2) of 1 sprites. Settings: Format: RGBA Compressed ETC2 8 bits
When Texture Compression is set to “ETC (default)” atlas get compressed to ETC1, but no any alpha atlases is built, and the size of non-alpha atlas is the same as the texture, so no any alpha get pushed to this atlas somewhere “near”.
Have you really tried this on a real Android device
Yes. I have it working on my HtcOneM8 as I post this reply. Maybe you have hit a case that we didn’t cover during testing. Could you submit a bug with a sample project?
ETC1 will kick in only if
- The build is Android and TextureOverride is set to ETC (default)
- The texture is part of an atlas
- The override option for enabling ETC1 is checked.
I checked the source of the log you mentioned, and its generated during the initial stages of sprite packing. The format is overridden based on setting of textures sometime after the log was issued. This log is hence misleading, and should be fixed.
The documentation at http://docs.unity3d.com/Manual/class-TextureImporterAndroid.html does not say to set the build texture override to ETC (default), it could do with updating.
Also it seems misleading in that first screenshot, where it says “RGBA Compressed ETC2 8bits (Atlas)” at the bottom, when the atlas format is in fact ETC1 + Alpha texture.
The sprite packer’s Alpha/RGB toggle button (the little rainbow thing at the top) does not work in this case either, the Alpha appears all white.
The tickbox for compress using ETC1 also disappears if you switch the texture to Advanced mode.
These have been logged as case 725748.
Thanks for logging the bug. I’ll look into it soon.
Hello! I think I know what’s the problem. I try to use this method with UI elements and it’s failed because in UI shader no any alpha ETC1 support, but in Sprite-Default shader I see this _AlphaTex field and all supporting stuff.
Sprites are part of UI and I think we all agree that UI shader also need support for ETC1+Alpha compression.
Is this possible? Can we see it in a patch update? If not and this is absolutely impossible, you should fix documentation so that it will say about SpriteRenderer only and not about sprites in general.
Yes. The UI elements do not work well with ETC1. We have a bug on it.
Hey sandboxed,
My results do not match your results. Any guess what I’m doing wrong?
I’m using 5.3.0f4. All of the sprites in the loadingdoors atlas that have alpha are checked for “Compress using ETC1”. The MunkySpritePacker is just the example code with “entry.settings.allowsAlphaSplitting = ti.GetAllowsAlphaSplitting();” included.
I want 2 ETC 1 textures, but I’m still getting ETC2 in the atlas and on device.
Did you set the texture override in the build settings to use ETC1?
If it still doesn’t solve the problem, then please report a bug, with a sample project. I’ll be happy to look into it.
Hi - what’s the status of the bug with ETC1 split alpha not working on UI elements - was it resolved as part of the 5.3 release (couldn’t find it mentioned in the release notes) ? If not is there an ETA ?
When you mentioned above that there’s a bug on it, is it this one in the issue tracker :
Thanks!
We did expose the alpha texture via a new sprite api
What this allows the user to workaround the UI / ETC1 issue while we get a proper fix out that works across all supported hardware.
You can see the Sprites-Default.shader to see how the alpha texture is used if you need a reference.
Looking at the default sprite shader, it has [PerRendererData] on _MainTex in the properties block, but not for _AlphaTex (which doesn’t even appear in the properties block, only in the shader code itself).
Is there any reason for this? Presumably each _AlphaTex variant needs to be passed in via the MaterialPropertyBlock like the main texture does ?
Ideally the _AlphaTex is not something that the user should set. The entire ETC1 + Alpha feature is handled by Unity in a transparent way to the user. Hence the _AlphaTex was not included in the properties block.
However, we did run into issues with UI Images, and hence exposed the AlphaTex via the sprite api to aid a workaround while we fix the thing internally. But this still doesn’t require _AlphaTex to be appearing in the inspector window, and should be set via code.
Understood.
Did anything else change with how alphaed sprites are rendered in Unity 5.3 upwards?
I ask as on upgrading from 5.2.1 to 5.3.1, the sprites I have using the ETC1 alpha split no longer render correctly (I made no other changes) - they have solid blocks around them, i.e. the alpha texture is being ignored.
These are straight SpriteRenderer’s, not UIImages.
Is there something new that needs to be setup to make them work or should I log a bug - it is very easily reproducible.
I download the unity5.3 UI source code project and rebuild UnityEngine.UI.dll when i modified the Image Component override material property(use the modified UIDefault shader) and sprite property (set _AlphaTex),partial code like these: defaultmaterial.shader = shader.Find(“UI-DefaultAlpha”); defaultmaterial.SetTexture(“_AlphaTex”,sprite.associatedAlphaSplitTexture);but it just did not work on unity5.3p2 ,the background is black,There should be something wrong with the sprite.associatedAlphaSplitTexture generated.Because this work fine on unity5.3f1.
On unity5.3f1 I found that modified UI Image component nested use has problem when set sprite.associatedAlphaSplitTexture via code (sprite.associatedAlphaSplitTexture != null).Which release unity version would fixe Image component problem when using ETC 4 bits split Alpha channel?(sorry,please forgive my poor english)