From 6319c8677c4d8c2820ad4929332191981861178d Mon Sep 17 00:00:00 2001 From: bnlrnz Date: Thu, 15 Oct 2020 12:54:48 +0200 Subject: [PATCH] trying to fix flickering caused by frustum culling --- Source/xsite_ue/MultiViewportCameraActor.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/xsite_ue/MultiViewportCameraActor.cpp b/Source/xsite_ue/MultiViewportCameraActor.cpp index d299e76..fb0f1ae 100644 --- a/Source/xsite_ue/MultiViewportCameraActor.cpp +++ b/Source/xsite_ue/MultiViewportCameraActor.cpp @@ -202,8 +202,17 @@ void AMultiViewportCameraActor::BeginPlay() UE_LOG(LogCave, Display, TEXT("[%s] Spawning Extra Window resolution: %s offset: %s"), *WindowTitle.ToString(), *InitialWindowRes.ToString(), *InitialWindowPos.ToString()); - IdentifyScreen(); - + // IdentifyScreen(); + + // this enables Hierarchical Z-Buffer Occlusion (see https://docs.unrealengine.com/en-US/Engine/Rendering/VisibilityCulling/index.html) + // we do this method to prevent flickering actors (static meshes) caused by aggressive default frustum/occlusion culling + // whenever an extra window is spawn (with a seperate view frustum than the "main" window) we should make shure to activate this + // we could also set r.AllowOcclusionQueries=0, but this would probably disable culling all together (which we do not want?) + if (this->PlayerController) + { + this->PlayerController->ConsoleCommand("r.HZBOcclusion 1"); + } + // initialize everything before we call base class so that in blueprint beginplay everything is ready Super::BeginPlay(); }