Search Issue Tracker
Won't Fix
Votes
1
Found in [Package]
12.0.0
Issue ID
1344181
Regression
No
CameraSortingTexture SubShader captures Normals from _NormalMap
Reproduction steps:
1. Open project "case_1344181-2DLightBug (2)"
2. Open Scene "SampleScene"
3. Enter Play Mode
4. Open Frame Debugger from Window > Analysis
5. Click Enable in the Frame Debugger window
6. Go to the #9 Event in the Frame Debugger
7. Observe Game view
Expected result: CameraSortingTexture shouldn't capture normals
Actual result: CameraSortingTexture only captures normals
Reproducible with: 11.0.0 (2021.1.16f1), 12.0.0 (2021.2.0b4, 2022.1.0a3)
Could not test with: 2019.4.29f1, 2020.3.14f1 (Doesn't have CameraSortingLayer Texture)
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
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
Resolution Note:
What is happening in this bug is that the _CameraSortingLayerTexture is being used after it has been freed and before it has been reallocated. Although it looks like it's capturing the normals, what is happening is the _CameraSortingLayerTexture is being used at an invalid time and is pointing to previously allocated memory that has been reused for normal rendering.
I have added a task to the backlog to point the _CameraSortingLayerTexture to a fixed texture (will either be black or pink) if it is not valid to be used, but as this could be a potential breaking change for some people, this needs design.
Additionally, I will be updating the documentation to warn against this use of the _CameraSortingLayerTexture