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
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
- Entities Hierarchy Search “Show/Hide” button’s Lens Icon is blurry when the Editor is on an external monitor
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).