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
- Test Runner’s vertical scrollbar overlaps with the up and down arrows and upper toolbar tabs when the window is minimized
- The Input Field view is not updated when deleting lines of text
- The scrollbar does not respect empty lines in the Input Field
- “Texture Atlas Viewer“ button text overlaps another button when the UI Toolkit Debugger is narrowed
- Thresholds are no longer automatically calculated after deleting Motion fields in Blendtrees
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.