Search Issue Tracker
Won't Fix
Votes
0
Found in
2022.3.61f1
6000.0.46f1
6000.1.0b14
6000.2.0a8
Issue ID
UUM-102343
Regression
No
Stencil WriteMask is null when using deferred pipeline
Reproduction steps:
1. Open the attached project "ReproProj"
2. Open the “/Assets/Scenes/SampleScene.unity” Scene
3. Enter the Play Mode
4. Notice how the silhouette of the "vehicle" is correctly rendered in the left camera (forward) and incorrect in the right camera (deferred)
5. Open Frame Debugger (Window > Analysis > Frame Debugger)
6. Look for the Camera.Render > Drawing where right car is shown in the Output
7. Observe the Stencil WriteMask
Expected result: The Sencil WriteMask is set to bit 5 (32)
Actual result: The Stencil WriteMask is null
Reproducible with: 2022.3.61f1, 6000.0.46f1 , 6000.1.0b14, 6000.2.0a8
Reproducible on:
Play Mode
Testing environment: Windows 10 Enterprise 21H2
Not reproducible on: No other environment tested
Comments (1)
-
m43_daniel
Apr 11, 2025 14:10
The writemask is not null. It's set to an hardcoded value. Just like the ref is. The big difference is that the ref is or'ed with the value from the shader while the writemask is not. For some unknown reason.
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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Resolution Note:
As mentioned in the documentation page linked below "Stencil functionality for objects rendered in the deferred rendering path is somewhat limited, as during the G-buffer pass and lighting pass, Unity uses the stencil buffer for other purposes. During those two stages, the stencil state defined in the shader will be ignored...": https://docs.unity3d.com/es/2021.1/Manual/SL-Stencil.html
This leads to your `WriteMask 32` not being set properly during the G-Buffer (as visible in the FrameDebugger, it's overridden to the '207' value, which has bit 5 set to 0) and thus not writing the value you expect).