Search Issue Tracker
By Design
Votes
1
Found in
2018.4
2020.2
2020.2.0a17
Issue ID
1262574
Regression
No
Textures become gray when they are converted with Graphics.ConvertTexture
How to reproduce:
1. Open user's attached "BugReport_GraphicsConvertTexture.zip" project
2. Open Assets/Textures folder
3. Observe the textures in the Textures folder
4. Go to BugReport -> Convert Textures
5. Open Assets/Textures_Converted folder
6. Observe the textures in the Textures_Converted folder
Expected result: Converted textures have a checkerboard pattern as the original textures
Actual result: Converted textures become gray with no checkerboard pattern
Reproducible with: 2018.4.24f1, 2019.4.4f1, 2020.1.0b16, 2020.2.0a18
Notes:
- The issue is reproducible with EncodeToPNG, EncodeToJPG and EncodeToTGA methods
- The issue is reproducible when converting to ARGB32, RGBA32 (and all other RG), BGRA32 texture formats
- The issue is reproducible with OpenGL, Vulkan, Metal, Direct3D Graphics APIs
Comments (1)
-
Peter77
Jul 13, 2020 13:09
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
- UnityLinker causes crash when outputting snapshot data for very large projects
- Camera Preview does not detect multiple cameras with same GameObject name
- Crash on TypeTreeIterator::Children() when renaming a corrupted asset while Asset Serialization is set to Mixed
- Cameras (Camera.targetDisplay) render only to Display 0 in the Player when Multi-Display setup is used and DX12 API is set
- [Vulkan] _CameraOpaqueTexture produces a feedback effect on Android Adreno devices when using Vulkan
Resolution Note (2020.2.X):
ConvertTexture works on the GPU side only, it does not set the proper CPU side pixel data. As a result, any pixel reading functionality gives invalid results (e.g. GetPixels, EncodeToPNG, etc). You should use Texture2D.ReadPixels to transfer pixels to the CPU side in another Texture2D and and then perform any pixel access operations on that new Texture.
We updated Graphics.ConvertTexture's behavior such that it flags the ConvertTexture destination texture as non readable, hence making it more clear that the output texture's pixels are not accessible.
We are internally discussing ConvertTexture's behavior and will take this case into consideration.