DFAO and Shift word origin

Our team are developing a multiplayer online battle royale game. We use both World Origin Shift and Distance Field Ambient Occlusion.When we use SetWorldOriginLocation function to shift the world, the Actor and physics both work correctly, but the DFAO is very weird as shown in the following image.

The right AO texture shoud be the following:

After eject, I found the Distance Field Ambient Occlusion Texture is not correct, not match the world’s primitives.
After some further investigation, I have found that the UStaticMeshComponent’s Distance Field not be updated in the Global Distance Field. The Global Distance Field does nothing when the world origin be shifted.

I fix it by modify some Rendering files below.

in the class FSceneInterface of SceneInterface.h :

  add:		virtual void UpdatePrimitiveDistanceFieldSceneData_GameThread(UPrimitiveComponent* Primitive) {};

in the class FScene of ScenePrivate.h:

add:  
        virtual void UpdatePrimitiveDistanceFieldSceneData_GameThread(UPrimitiveComponent* Primitive) override;
         void UpdatePrimitiveDistanceField_RenderThread(FPrimitiveSceneProxy* PrimitiveSceneProxy);

in the RenderScene.cpp:

 add :
  void FScene::UpdatePrimitiveDistanceFieldSceneData_GameThread(UPrimitiveComponent* Primitive)
{	
           if(Primitive->SceneProxy)
           {
	    FScene* Scene = this;
	    ENQUEUE_RENDER_COMMAND(UpdateDistanceFieldCommand)(
		[Scene, Primitive](FRHICommandListImmediate& RHICmdList)
		{
			FScopeCycleCounter Context(Primitive->SceneProxy->GetStatId());
			Scene->UpdatePrimitiveDistanceField_RenderThread(Primitive->SceneProxy);
		});
         }
}

void FScene::UpdatePrimitiveDistanceField_RenderThread(FPrimitiveSceneProxy* PrimitiveSceneProxy)
{
	 DistanceFieldSceneData.UpdatePrimitive(PrimitiveSceneProxy->GetPrimitiveSceneInfo());
 }

in the class UPrimitiveComponent of PrimitiveComponent.h:

add:  virtual void ApplyWorldOffset(const FVector& InOffset, bool bWorldShift) override;

in the PrimitiveComponent.cpp

add:  	
    void UPrimitiveComponent::ApplyWorldOffset(const FVector& InOffset, bool bWorldShift)
    {
    	Super::ApplyWorldOffset(InOffset, bWorldShift);
    	if (SceneProxy)
    	{
    		GetWorld()->Scene->UpdatePrimitiveDistanceFieldSceneData_GameThread(this);
    	}
    } 

That fix the problem.
Though I fix by myself, but I think offset the Global Distance Field Volume Texture in
FScene::ApplyWorldOffset_RenderThread(FVector InOffset) function must be elegant and efficient.

Our game website : http://en.zogame.com.cn/

Thank you for this report, we are currently tracking this at: Unreal Engine Issues and Bug Tracker (UE-55375)

The workaround suggested is similar to yours above:

“FPrimitiveSceneInfo::ApplyWorldOffset should call DistanceFieldSceneData.UpdatePrimitive(this); That will cause ProcessPrimitiveUpdate to be called again for that object, fetching the new offsetted proxy bounds and uploading them to the DistanceFieldSceneData (GPU representation of the scene)”

Hi,
we experience the same issue in our project. Your fix is great, simple and is working. Unfortunately, this causes hitches with ~400ms duration while doing origin rebasing. Do you have the same performance issue? Do you have a different solution in the meanwhile?

Also curious on this. stumbled back on this thread after looking into some issues with ray traced distance field shadows, which seem to be bugged in 4.23.1 when you rebase :confused: (very early days looking into it though…)

Woo. i was able to reproduce a bug with Distance Field Shadows moving when you rebase, i don’t remember this in 4.23, but it happens in 4.23.1 now. I have submitted a bug report (just incase anyone else here reads this…)

We are working in with 4.22.3. I think this bug was never fixed.

I’ve implemented a fix for this problem here:

https://github.com/EpicGames/UnrealEngine/pull/6424

Maybe this helps