Search Issue Tracker
By Design
Votes
1
Found in
2018.4
2018.4.19f1
2019.4
2020.1
2020.2
Issue ID
1252848
Regression
No
Shuriken particles depth offset is not working(has no affect) when 'Renderer Alignment' is set to 'View'
How to reproduce:
1. Open attached project "-DepthOffset.zip" and scene "SampleScene" located in Assets root folder
2. Enter Play mode
3. Observe Game or Scene view
Expected result: all three particle effects behave the same
Actual result: the left/red particle effect is clipping through the cube, even though the Depth Offset Factor is set to -5000
Reproducible with: 2018.4.23f1, 2019.4.0f1, 2020.1.0b12, 2020.2.0a14
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
- Top and bottom color channels are swapped when lighting an object with Six Way Shader Graph in URP
- "Problem detected while importing the Prefab file" errors on Learning Templates import
- Crash on RaiseException during Socket.BeginConnect in Player when application connection is blocked through commercial firewall
- Decal Projector produces artifacts when the normal and decal are projected in negative z-direction and Normal Blend is set to 1
- Undoing slider field change only resets slider position, doesn't undo the value change
Resolution Note:
This is due to how the depth offset factor is defined, it will not have any effect on triangles which are aligned with the camera plane.
The depth offset factor scales with respect to the Z slope of the polygon. When using the 'View' particle system Renderer Alignment, the particles are aligned with the camera plane. This means all of the particles will have a Z slope of 0. Thus, the effect of the depth offset factor will be eliminated, as it will be multiplied with 0.
In the other particle system render alignments, the particle polygons are not perfectly aligned with the camera plane and so there is a z-slope and so the depth offset factor will have an effect with these.
See https://docs.unity3d.com/Manual/SL-CullAndDepth.html
"Factor scales the maximum Z slope, with respect to X or Y of the polygon"
For detailed reference of exactly how this works in GPU hardware, see the graphics API specifications:
In OpenGL, the depth bias Factor and Units correspond to the glPolygonOffset(Factor, Units). See section 14.6.5 of the OpenGL 4.6 core reference.
In D3D11, the depth offset Factor corresponds to the SlopeScaledDepthBias field of D3D11_RASTERIZER_DESC. See
https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias
or https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm#15.10%20Depth%20Bias
for a reference on how this functionality works.
For Vulkan, see 24.7.3 - Depth Bias https://www.khronos.org/registry/vulkan/specs/1.2/html/chap25.html#primsrast-depthbias where the depth offset Factor corresponds to depthBiasSlopeFactor.