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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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.