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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.