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
- Fixing Message Loss in UMPE During Domain Reload
- The Editor freezes when ScheduleReadOnly of IJobParallelForTransform with dependency is used
- Text is truncated in the Inspector when the display scale is set to 150%
- CancellationTokenSource(<timeout>) has incorrect cancellation status when used in WebGL Player
- VFX property value names are cut off when properties with 'Arc' are viewed in the VFX Blackboard
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.