Search Issue Tracker
By Design
Votes
5
Found in
2021.2
2021.2.0b13
2022.1
Issue ID
1369697
Regression
No
Texture contents are not copied correctly when using CopyTexture method and HDR property is disabled on Camera
How to reproduce:
1. Open the user's attached "crest" project
2. Open the "main" Scene
3. Enter Play Mode
4. Press "E" on the keyboard to move up above the water
5. Observe the copied Texture in the Game view
Expected result: The copied Texture is normal and not brightened
Actual result: The Texture is not copied correctly, washed, too bright
Reproducible with: 2021.2.1f1, 2022.1.0a14
Couldn't test with: 2019.4.32f1 (script error due to Crest version that's available only from 2020.3), 2020.3.22f1, 2021.1.28f1 (user script error related with the OceanRenderer)
Note:
Not reproducible on Metal
Not reproducible with Blit method
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
The issue is By Design. It's mentioned that the built-in Camera target RT format is R8B8G8A8_SRGB and the texture user gets is R8B8G8A8_UNorm.CopyTexture should just do a memcopy without altering the data and _UNorm vs _SRGB affects how the colors are sampled so it's simply an issue of different formats which is by design. There is a file called XRHelper.cs, where the developer have done some changes which will return a default format rather than UNORM:
public static RenderTextureDescriptor GetRenderTextureDescriptor(Camera camera)
{
#if _XR_ENABLED
if (IsRunning)
{
return XRSettings.eyeTextureDesc;
}
else
#endif
{
// Use a different constructor here passing an explicit GraphicsFormat that's based on DefaultFormat and the current colorspace. This should match the color targets the user wants to copy from.
return new RenderTextureDescriptor(camera.pixelWidth, camera.pixelHeight, SystemInfo.GetGraphicsFormat(DefaultFormat.LDR), 0);
}
}