Search Issue Tracker
By Design
Votes
0
Found in
2021.3.5f1
2022.1.5f1
2022.2.0a19
2023.1.0a1
2023.2.0a1
Issue ID
UUM-7824
Regression
Yes
Sampling a custom depth texture on a machine with a GTX 1080 makes object's textures display the wrong color when in Play mode or Player
How to reproduce:
# Open the attached project
# Open the “SampleScene” Scene
# Enter Play mode or Build And Run
Expected result: Cube is yellow
Actual result: Cube is red
Reproducible with: 2021.2.0b4, 2021.3.5f1, 2022.1.5f1, 2022.2.0a21
Not reproducible with: 2019.4.40f1, 2020.3.36f1, 2021.2.0b3
Reproducible on: Windows 10 with GTX 1080
Not reproducible on: macOS (Intel) Monterey 12.3.1
Notes:
* 2021.3.3f1 with GTX 1080: red cube
* 2021.3.3f1 with GTX 1660: yellow cube
* 2021.3.3f1 with RTX 2080: yellow cube
* 2019.4.39f1 with GTX 1080: yellow cube
* 2019.4.26f1 with GTX 1080: yellow cube
* 2019.4.26f1 with GTX 1660: yellow cube
* 2019.4.26f1 with RTX 2080: yellow cube
UPDATE 2/21/2023:
The user is sampling a depth texture and Unity by default assumes this is a shadowmap and uses a comparison sampler. Since no comparison value is provided this causes undefined behavior on some drivers. This can be worked around by overriding the shadow sampling mode after creation. We could fix this by exposing a way for the user to indicate whether or not a depth texture is a shadowmap in the RenderTextureDescriptor but not sure if this is worth prioritizing.
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
- "One or more data file missing for baking set NewScene Baking Set. Cannot load shared data." error in Player when a specific project is built
- Choosing new HDR Colour using RGB values breaks colour on Intensity Selectors
- Rendering/Decal Layer Mask options are different inside Prefab Mode and outside Prefab Mode when the project is upgraded to Unity 6
- Incorrect Realtime GI Light Probes baking when more than one Light Probe Group is used and "Baked Global Illumination" is enabled
- Hovering on the three-dot menu also highlights the tab header near it when not all tabs fit the bar
Resolution Note:
The user is sampling a depth texture and by default, the shadow sampling mode is set to CompareDepths. Since no comparison value is provided by the user, this causes undefined behavior on some drivers. To fix this, the RenderTextureDescriptor.ShadowSamplingMode should be set to RawDepth. See https://docs.unity3d.com/2021.3/Documentation/ScriptReference/RenderTextureDescriptor-shadowSamplingMode.html