Hey folks, I would like to render scene depth to disk. To achieve this I took code from the UnrealCV guys (https://unrealcv.org/) but using SceneCaptureComponents and RenderTargets. As I mainly develope on Linux I can say that this works like a charm on Vulkan RHI (on Linux and Windows). Though due to Raytracing features etc. I would like to switch to Windows and use DX12.
Now here is the issue: Using DX12 (or DX11 likewise) the program crashes on scene depth rending with following report:
Assertion failed: TextureDesc.Format == GPixelFormats[PF_FloatRGBA].PlatformFormat [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\Windows\D3D11RHI\Private\D3D11RenderTarget.cpp] [Line: 1193] UE4Editor_Core UE4Editor_Core UE4Editor_Core UE4Editor_Core UE4Editor_D3D11RHI UE4Editor_RHI UE4Editor_EndlessRunner_1742!`ABaseCaptureActor::CaptureFrameFloat16NonBlocking'::`2'::EURCMacro_ReadSurfaceFloatCommand::DoTask() [c:\users\timmhess\documents\workspaceunrealengine4\endlessrunner\source\endlessrunner\private\cameracapture\basecaptureactor.cpp:298] UE4Editor_EndlessRunner_1742!TGraphTask<`ABaseCaptureActor::CaptureFrameFloat16NonBlocking'::`2'::EURCMacro_ReadSurfaceFloatCommand>::ExecuteTask() [c:\program files\epic games\ue_4.22\engine\source\runtime\core\public\async\taskgraphinterfaces.h:842] UE4Editor_Core UE4Editor_Core UE4Editor_RenderCore UE4Editor_RenderCore UE4Editor_Core UE4Editor_Core kernel32 ntdll
Something seems to be off in the format of the Render Target as TextureDesc.Format == GPixelFormats[PF_FloatRGBA].PlatformFormat suggests. Though I have no clue how to approach this further.
The RenderTarget is setup to use a float format as following:
RenderTarget = NewObject<UTextureRenderTarget2D>(); RenderTarget->InitCustomFormat(FrameWidth, FrameHeight, PF_FloatRGBA, true); RenderTarget->RenderTargetFormat = ETextureRenderTargetFormat::RTF_RGBA16f;
I also eperimented with different formats such as RTF_RGBA32f and also other PF_… but this did not fix the crashing.
Appreciating all help.