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
- Some phrases and words stay in other languages when the Editor language is switched back to English
- UI Builder window does not mark the document as dirty when the "Unset" action is performed on an element of a nested document
- Shader Graph node settings warning text colour is very hard to read
- Inconsistent logic on when 'open VFX graph Samples' button appears on Visual Effect Graph in Package Manager
- Unable to dock tabs on panels when non-standard pointers are used (touch-screen, tablet and pen)
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.