Skip to content

fix(camera): support Vulkan depth readback - #89

Open
alexhegit wants to merge 1 commit into
URLab-Sim:mainfrom
alexhegit:fix/vulkan-depth-readback
Open

alexhegit wants to merge 1 commit into
URLab-Sim:mainfrom
alexhegit:fix/vulkan-depth-readback

Conversation

@alexhegit

Copy link
Copy Markdown

Summary

  • switch depth camera render targets from R32f to RGBA32f
  • keep linear scene depth in the R channel and preserve the existing one-float-per-pixel consumer API
  • update depth preview comments and camera format tests
  • assert both RenderTargetFormat and the actual EPixelFormat

Problem

On UE 5.7's Vulkan backend, URLab depth capture allocates PF_R32_FLOAT and reads it through ReadSurfaceData(..., TArray<FLinearColor>, ...). VulkanRenderTarget.cpp does not implement VK_FORMAT_R32_SFLOAT conversion in that path and asserts:

Unsupported format [100] for conversion to FLinearColor

This crashes the editor when a depth frame is read back on Vulkan.

Fix

Use RTF_RGBA32f / PF_A32B32G32R32F, which UE 5.7 Vulkan supports in the FLinearColor readback path. URLab still extracts only .R, so the ZMQ/SHM and ConsumeFloatPixels() contracts remain one float32 depth value per pixel.

Trade-off: the internal depth render target consumes 4× the GPU memory and copy bandwidth of R32f. The external frame format is unchanged.

Validation

  • Regression test observed failing before the implementation change
  • URLab.Camera.DepthMode_ConfiguresSceneDepthFloat passes
  • Full Linux NullRHI suite: 269/269 passed
  • UE 5.7.4 offscreen Vulkan smoke test on NVIDIA A30
  • Minimal MJCF imported and instantiated
  • RGB render and float32 depth readback produced nonblank geometry
  • Depth range: 330.621–401.269 cm, 2,967 valid pixels at 320×240

Environment: UE 5.7.4, clang 20.1.8, NVIDIA driver 580.178.04.

Use an RGBA32f render target for depth capture because UE 5.7 Vulkan cannot convert VK_FORMAT_R32_SFLOAT through the FLinearColor readback path. Preserve the one-float-per-pixel consumer API by extracting depth from the R channel, and cover both declared and actual pixel formats in camera tests.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant