DBuffer decals in Rift render in single eye

Using UE 4.5 (this also happened in 4.4.3) DBuffer based decals only render in the right eye while using the Oculus Rift. Unfortunately, this makes decals unusable for VR.

As you can see in the image, the bullet hole decals are only being rendered in the right eye. The decals themselves reference a Material Instance. The Material being used by the Instance has its Material Domain set to Deferred Decal, and its Decal Blend Mode is “DBuffer Translucent Color, Normal, Roughness”. Finally, I have the appropriate rendering cvars set (r.DBuffer=1, etc.).

Is there anything I can do at my end to get these working? Not being able to use DBuffered decals at all in VR is extremely limiting.

Update: Still happening in UE 4.5.1.

Hi Gnometech,

Unfortunately DBuffer Decals and some HUD elements do not work properly with VR at the moment. This is a known issue that our developers are currently looking into. I hope to have some more info on this soon and will post back here.

Thanks,

TJ

Thanks for letting me know. I hope this can be fixed soon. The environment is sterile without decals.

I just wanted to update and let you know that this has been logged into our tracking software as JIRA #2941.

1 Like

Hello,

I ran into this problem as well in 4.5.1, and was able to track the issue to the DBuffer clears in FRCPassPostProcessDeferredDecals::Process in PostProcessDeferredDecals.cpp:

   SCOPED_DRAW_EVENT(RHICmdList, DBufferClear, DEC_SCENE_ITEMS);
    {
    	SetRenderTarget(RHICmdList, GSceneRenderTargets.DBufferA->GetRenderTargetItem().TargetableTexture, FTextureRHIParamRef());
    	RHICmdList.Clear(true, FLinearColor(0, 0, 0, 1), false, 0, false, 0, FIntRect());
    	SetRenderTarget(RHICmdList, GSceneRenderTargets.DBufferB->GetRenderTargetItem().TargetableTexture, FTextureRHIParamRef());
    	// todo: some hardware would like to have 0 or 1 for faster clear, we chose 128/255 to represent 0 (8 bit cannot represent 0.5f)
    	RHICmdList.Clear(true, FLinearColor(128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1), false, 0, false, 0, FIntRect());
    	SetRenderTarget(RHICmdList, GSceneRenderTargets.DBufferC->GetRenderTargetItem().TargetableTexture, FTextureRHIParamRef());
    	// R:roughness, G:roughness opacity
    	RHICmdList.Clear(true, FLinearColor(0, 1, 0, 1), false, 0, false, 0, FIntRect());
    }

The issue is that each of those calls to Clear() cleared the entire surface, so the right eye cleared the decals from the left eye. The solution is to add a call to SetViewport() after each call to SetRenderTarget():

 SCOPED_DRAW_EVENT(RHICmdList, DBufferClear, DEC_SCENE_ITEMS);
    {
    	SetRenderTarget(RHICmdList, GSceneRenderTargets.DBufferA->GetRenderTargetItem().TargetableTexture, FTextureRHIParamRef());
    	Context.SetViewportAndCallRHI(Context.View.ViewRect); // FIXES bug with no decals in left eye
    	RHICmdList.Clear(true, FLinearColor(0, 0, 0, 1), false, 0, false, 0, FIntRect());
    	SetRenderTarget(RHICmdList, GSceneRenderTargets.DBufferB->GetRenderTargetItem().TargetableTexture, FTextureRHIParamRef());
    	Context.SetViewportAndCallRHI(Context.View.ViewRect); // FIXES bug with no decals in left eye
    	// todo: some hardware would like to have 0 or 1 for faster clear, we chose 128/255 to represent 0 (8 bit cannot represent 0.5f)
    	RHICmdList.Clear(true, FLinearColor(128.0f / 255.0f, 128.0f / 255.0f, 128.0f / 255.0f, 1), false, 0, false, 0, FIntRect());
    	SetRenderTarget(RHICmdList, GSceneRenderTargets.DBufferC->GetRenderTargetItem().TargetableTexture, FTextureRHIParamRef());
    	Context.SetViewportAndCallRHI(Context.View.ViewRect); // FIXES bug with no decals in left eye
    	// R:roughness, G:roughness opacity
    	RHICmdList.Clear(true, FLinearColor(0, 1, 0, 1), false, 0, false, 0, FIntRect());
    }

I hope this helps,

Thanks , solved the issue for me :slight_smile:

Just posting to let you know the answer below by is the valid one.

Same Issue with 4.11, but seems like the code its being changed, any idea what to do? thx in advance :smiley:

Hi Icchansan,

This issue was reported in 2014 and was resolved in the 4.8 release. If you are seeing it now in 4.11, could you please create a new report in the Bug Report section of AnswerHub? Please include as much info as possible, including screenshots.

Thanks,

TJ