You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Fix LOD problems in ray tracing
* Static meshes with WPO were selecting the wrong LOD * HLOD was not respected in ray tracing. This was hard to fix, but with GatherRayTracingWorldInstances moved to be after InitViews now we can reuse the results directly. HLOD calculation does not depend on frustum culling so it is exactly we want. #jira #rb juan.canada #ROBOMERGE-OWNER: jeanmichel.dignard #ROBOMERGE-AUTHOR: yujiang.wang #ROBOMERGE-SOURCE: CL 12138717 via CL 12138891 via CL 12138916 #ROBOMERGE-BOT: TOOLS (Main -> Dev-Tools-Staging) (v661-12148976) #ushell-cherrypick of 12180799 by yujiang.wang [CL 12232830 by Juan Canada in 4.25 branch]
This commit is contained in:
@@ -545,12 +545,15 @@ int8 ComputeStaticMeshLOD( const FStaticMeshRenderData* RenderData, const FVecto
|
||||
{
|
||||
const int32 NumLODs = MAX_STATIC_MESH_LODS;
|
||||
const FSceneView& LODView = GetLODView(View);
|
||||
const float ScreenRadiusSquared = ComputeBoundsScreenRadiusSquared(Origin, SphereRadius, LODView) * FactorScale * FactorScale * LODView.LODDistanceFactor * LODView.LODDistanceFactor;
|
||||
const float ScreenRadiusSquared = ComputeBoundsScreenRadiusSquared(Origin, SphereRadius, LODView);
|
||||
|
||||
// Walk backwards and return the first matching LOD
|
||||
for (int32 LODIndex = NumLODs - 1; LODIndex >= 0; --LODIndex)
|
||||
{
|
||||
if (FMath::Square(RenderData->ScreenSize[LODIndex].GetValueForFeatureLevel(View.GetFeatureLevel()) * 0.5f) > ScreenRadiusSquared)
|
||||
float ScreenSizeScale = FactorScale * LODView.LODDistanceFactor;
|
||||
float MeshScreenSize = RenderData->ScreenSize[LODIndex].GetValueForFeatureLevel(View.GetFeatureLevel()) * ScreenSizeScale;
|
||||
|
||||
if (FMath::Square(MeshScreenSize * 0.5f) > ScreenRadiusSquared)
|
||||
{
|
||||
return FMath::Max(LODIndex, MinLOD);
|
||||
}
|
||||
|
||||
@@ -780,6 +780,15 @@ bool FDeferredShadingSceneRenderer::GatherRayTracingWorldInstances(FRHICommandLi
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FSceneViewState* ViewState = (FSceneViewState*)View.State;
|
||||
const bool bHLODActive = Scene->SceneLODHierarchy.IsActive();
|
||||
const FHLODVisibilityState* const HLODState = bHLODActive && ViewState ? &ViewState->HLODVisibilityState : nullptr;
|
||||
|
||||
if (HLODState && HLODState->IsNodeForcedHidden(PrimitiveIndex))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//#dxr_todo UE-68621 The Raytracing code path does not support ShowFlags since data moved to the SceneInfo.
|
||||
//Touching the SceneProxy to determine this would simply cost too much
|
||||
|
||||
Reference in New Issue
Block a user