Search Issue Tracker
By Design
Votes
1
Found in
2020.3
2021.1
2021.2
Issue ID
1321754
Regression
No
[WebGL] Alpha values are black when a texture is created from the downloaded image file
If one creates a Texture that is downloaded from a file, it is properly created with alpha on other platforms, but that does not work on WebGL.
How to reproduce:
1. Open the attached project
2. Make a WebGL build
3. Host the built WebGL Player
4. Open the WebGL Player in a browser
5. In the Player, click on the "Load a new texture" button
6. Select an image that has transparency
7. Preview the loaded image
Expected result: The image has a transparent background
Actual result: The image has a black background
Reproducible with: 2020.3.1f1, 2021.1.0f1, 2021.2.0a7
Couldn't test with: 2018.4.33f1, 2019.4.22f1 ("TypeError: Cannot read property 'addEventListener' of null" is thrown when clicking the "Load new texture" button), 2021.2.0a8, 2021.2.0a9 (Errors when trying to build the WebGL Player)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Build process only shows Initializing when building for Android
- TileMap Palette preview flickers when scaled
- ShaderGraph Blackboard "plus" sign is not centered within the button
- [URP] When Rendering Layers are enabled, the DepthNormalPrepass is enabled even if not used
- Shader Graph Asset icon is blurry in the 4K monitors
Resolution Note:
User's project included a JavaScript plugin to handle the upload of the image file from the user. The upload resized the image to ensure a maximum texture size of 1024x1024 pixels. Unfortunately the resize function encoded the resized image as JPEG and lost the alpha channel. When the resize_image function is adjusted to generate an image/png then the texture upload works ok with an alpha channel.