Search Unity

simulation.capture: Capturing RGB + Depth fails

Discussion in 'Unity Simulation' started by joaomacpereira, Nov 12, 2021.

Thread Status:
Not open for further replies.
  1. joaomacpereira

    joaomacpereira

    Joined:
    Oct 29, 2021
    Posts:
    1
    We're trying to capture RGB and depth images from a single camera, using
    CaptureCamera.CaptureColorAndDepthToFile()


    Problem: Two images are created, but they have the same content: both the RGB and the Depth images are monochrome depth images.

    Calling only
    CaptureCamera.CaptureColorToFile()
    works and generates a color image, but if we call
    CaptureCamera.CaptureDepthToFile()
    after that while still in the same frame, it fails in the same way.


    The code:
    Code (CSharp):
    1. CaptureCamera.CaptureColorAndDepthToFile(
    2.     _camera,
    3.     _format,
    4.     rgbPath,
    5.     _fileFormat,
    6.     _format,
    7.     depthPath,
    8.     _fileFormat
    9. );
    Where
    _format=GraphicsFormat.R8G8B8A8_UNorm
    and
    _fileFormat=CaptureImageEncoder.ImageFormat.Png


    Versions:
    Unity 2020.3.22f1 - project is using URP
    com.unity.simulation.capture 0.0.10-preview.24
    Operating system: Linux (Ubuntu 20.04)

    Any help would be appreciated :)
     
Thread Status:
Not open for further replies.