Conclusion:
If !ViewFamily.EngineShowFlags.IndirectLightingCache ||
, in file: ./Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp
Line 1319,
is correct, a view is rich if is missing the EngineShowFlags.IndirectLightingCache
.
Then something needs to fix in FPositionOnlyDepthDrawingPolicy
in file ./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp
;
In file./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp
Line 512,
one of paramter VertexDeclaration
should take the blame for this bug. Because if I replace this VertexDeclaration
with FMeshDrawingPolicy::GetVertexDeclaration()
which directly use method in the base class of FPositionOnlyDepthDrawingPolicy
, blink stops.
This time, the collateral damage is also fixed!!! Even after I apply build light only, there is no blink or black screen
Deduction:
If !ViewFamily.EngineShowFlags.IndirectLightingCache ||
, in file: ./Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp Line 1319,
is correct.
If set Result.bStaticRelevance = true;
in File ./Engine/Source/Runtime/Engine/Private/StaticMeshRender.cpp
Line 1225, blink starts no matter what value Result.bDynamicRelevance
is.
Located in File /Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp
Line 1755 function ComputeAndMarkRelevanceForViewParallel
triggers this bug.
Because if bStaticRelevance = true
in StaticMeshRender.cpp
, this will lead to RelevantStaticPrimitives.AddPrim(BitIndex);
in SceneVisibility.cpp#Line1495
when ComputeRelevance
is called.
And then after function MarkRelevant
is called which makes MarkMasks[StaticMesh.Id] = MarkMask;
.
But in the end, it is static method static void ComputeAndMarkRelevanceForViewParallel
fired this two functions, ComputeRelevance
and MarkRelevant
.
So in the ComputeAndMarkRelevanceForViewParallel
, if this bit, StaticMeshOccluderMap_Word |= (MaskMask & EMarkMaskBits::StaticMeshOccluderMapMask) ? Mask : 0;
, sets, will lead to the bug.
=> Blink stops if remove Line 931, bDirty |= Scene->PositionOnlyDepthDrawList.DrawVisible(RHICmdList, View, DrawRenderState, View.StaticMeshOccluderMap, View.StaticMeshBatchVisibility);
, in file ./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp
;
=> Which leaves us a policy, FPositionOnlyDepthDrawingPolicy
in the same file DepthRendering.cpp
.
=> Finally, return FBoundShaderStateInput(VertexDeclaration, VertexShader->GetVertexShader(), FHullShaderRHIRef(), FDomainShaderRHIRef(), FPixelShaderRHIRef(), FGeometryShaderRHIRef());
In file./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp
Line 512, one of paramter VertexDeclaration
should take the blame for this bug. Because if I replace this VertexDeclaration
with FMeshDrawingPolicy::GetVertexDeclaration()
which directly use method in the base class of FPositionOnlyDepthDrawingPolicy
, blink stops.
I know the actual problem may be in VertexFactory->GetPositionDeclaration()
, however I am gonna stop here waiting for official fixes.
Hope this track can be helpful.
For those who can not wait for the official fixes:
Please ignore all my other comments and answers above this line in this page In file./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp
Line 512, replace VertexDeclaration
with FMeshDrawingPolicy::GetVertexDeclaration()
, blink stops!
Warning: This replacement isn’t a best solution or even a solution and also may affect other functionality, even though it fixes this bug superficially. Please wait official bug fix if you encounter side effects