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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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).