Search Issue Tracker
By Design
Votes
0
Found in
2022.3.20f1
2023.2.10f1
2023.3.0b7
6000.0.0b11
Issue ID
UUM-63999
Regression
No
Shader Sampling Global Texture flickers when the mouse is moved over the Inspector window of a Material
Reproduction steps:
1. Open the attached "DemoShaderProject" project
2. Open "Assets/Scenes/SampleScene" scene
3. Click on "Assets/Materials/M_SurfaceShader_DepthIssue" to open its' Inspector window
4. Move the mouse over the Material properties and the Game view
5. Observe the results
Expected results: The Texture is visually stable
Actual results: The Texture flickers
Reproducible with: 2022.3.20f1, 2023.2.10f1, 2023.3.0b7
Could not test with: 2021.3.35f1(no suitable method found to override for SetupRenderPasses)
Reproducible on: Windows 11 Pro, MacOS 14.2.1 (User's)
Not reproducible on: No other environments tested
Note: Also reproducible by expanding/contracting the preview of the Material
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
- Unity CIL Linker fails on Player build when persistent listeners have "<" and ">" in their XML attribute names
- ”Lighting data asset ‘LightingData’ is incompatible with the current Unity version…” warnings are thrown when saving Indoors (URP) and Outdoors (URP) Scenes as Scene Templates
- [iOS] The screen blinks when transitioning from custom to Unity splash screen
- [macOS] ”Ignoring depth surface load action as it is memoryless” warnings are thrown when taking Game View Snapshot
- UI Builder Inspector scrolls back up when changes on an expanded but not fully displayed Inspector tab are saved
Resolution Note:
Hello,
From what I see, the result is expected because your scriptable render passes rely on a side effect from other cameras.
Here's what I see in RenderDoc:
- First all opaque objects are rendered, including your object in the scene with the ShaderGraph reading the `_TerrainSurfaceDepth` texture.
- Next is the TerrainDepth pass, generating the depth texture `_TerrainSurfaceDepth` by drawing the terrain
- Lastly, transparent objects are rendered.
The problem is that you're reading the `_TerrainSurfaceDepth` texture in ShaderGraph before the TerrainDepth initialize its data correctly, which means that instead it's reading whatever was in the texture before.
What happens with the preview in the inspector is that the TerrainDepth pass clears the _TerrainSurfaceDepth texture and then when the game view / scene view renders, it can only read black hence the flickering between valid and cleared data.
To fix this issue, you can move your scriptable render feature to another injection point before the rendering of opaque objects. For example, "BeforeRenderingOpaques" would work well as the _TerrainSurfaceDepth will be initialized correctly before being used when opaque objects are rendered.