Plugin for capturing camera (GB + depth + motion vectors) data from multiple cameras in UE 5
Provides:
- An actor component
CaptureComponent
which can be added to any actor. It will automatically find allSceneCapture2D
components that are attached to the parent actor. For each camera it finds, it will configure that camera to output depth and motion vectors (by applying theM_DmvCapture
post process material to it) and will configure it to output to a render texture. It will then create a copy of each camera which will render the color data to a texture as well. These textures can be captured (for other uses in the engine), and optionally serialized / saved to disk. The component can be configured to capture every frame of the camera or to capture frames at a specific interval of time. - A
M_DmvCapture
material for saving depth + motion vectors to a single texture (used byCaptureComponent
)
See the unreal-camera-capture-example repo for a simple example project using this plugin.
See also the unreal-python-tools repo for some example code which provides processing and display of the data produced by the component in this repo.
The CameraCapture
plugin's CaptureComponent
creates the following data files
within the SaveLocation
:
camera_config.csv
: CSV formatted data (first row is header), which as the follow information:name
: The name of the camerawidth
: The width of the image in pixelsheight
: The height of the image in pixelsfocalLength
: The focal length of the camera in metersfov
: The horizontal field of view of the cameranearClipPlane
: The near clip plane of the camera view frustum in metersfarClipPlane
: the far clip plane of the camera view frustum in meters (may beinf
)tx
: The relative position of the camera w.r.t. the actor position, x-axisty
: The relative position of the camera w.r.t. the actor position, y-axistz
: The relative position of the camera w.r.t. the actor position, z-axisqw
: The relative orientation of the camera w.r.t. the actor orientation, w-componentqx
: The relative orientation of the camera w.r.t. the actor orientation, x-componentqy
: The relative orientation of the camera w.r.t. the actor orientation, y-componentqz
: The relative orientation of the camera w.r.t. the actor orientation, z-component
transformations.csv
: CSV formatted data (first row is header), which has the following information:i
: frame indextime
: time since the start of the program at which data (frames/transforms) were capturedtx
: actor world position along the world x-axisty
: actor world position along the world y-axistz
: actor world position along the world z-axisqw
: actor world orientation as a quaternion, w-componentqx
: actor world orientation as a quaternion, x-componentqy
: actor world orientation as a quaternion, y-componentqz
: actor world orientation as a quaternion, z-component
<camera name>_<index>.raw
: Uncompressed 4-channel, 32bit float formatted (32bit float per channel) color image data for<camera_name>
at 0-indexed<index>
. The mapping from<index>
to time can be found in thetransformations.csv
file.<camera name>_depth_motion_<index>.raw
: Uncompressed 4-channel 32bit float formatted (32bit float per channel) depth (red channel) + motion vector data (pixel x-y motion frame to frame in the green and blue channels) for<camera name>
at 0-indexed<index>
. The mapping from<index>
to time can be found in thetransformations.csv
file.
The output data in this folder can be visualized using the display_raw python script. An example visualization can be found below: